Я не могу $emit
событие от дочернего компонента до его родителя.
Я могу успешно отправить событие, но не получить его в родительском.
Results.vue
( Ребенок ):
<a href="#" v-on:click="sendResultValues"></a>
//
methods: {
sendResultValues: function () {
this.$emit('send-result-values', 'carrier');
}
},
Когда я нажимаю <a>
, я вижу с помощью Vue DevTools, что событие $emit
запускается:
Тем не менее, ничего не получено в console.log, как мой код ниже (родитель):
Input.vue
( Родитель ):
<search-results></search-results> //Results.vue component
<search-popover v-on:send-result-values="showResultData"></search-popover>
//
methods: {
showResultData: function () {
console.log("Data received from child: ")
}
},