[英]How can i get boolean data from another component in vue js?
I have two Components.我有两个组件。
In the second component, "date-detail-filter" I always keep track for boolean value, and want to access this data in my parent component.在第二个组件“date-detail-filter”中,我始终跟踪 boolean 值,并希望在我的父组件中访问这些数据。
do you know how to use $emit?你知道如何使用 $emit 吗?
In your date-detail-filter component在您的日期详细信息过滤器组件中
you can add this to your method.您可以将其添加到您的方法中。 this.$emit('your-event-name', 'your payload')
and in your main component.并在您的主要组件中。
<date-detail-filter @your-event-name="functionName()"/>
functionName(payload) {
your logic here to hide the caret
}
$emit is used to pass data from child component to parent component via event. $emit 用于通过事件将数据从子组件传递到父组件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.