The following are sub-components @change='showChange' is the sub-component event
The following templates are registered as order-type components
The following are sub-component methods:
showChange(event) { for (let branch of this.branchList) { if (branch['id'] === event.target.value) { this.$emit('showChange',branch['prefix']); } }
The following is the parent component
But alert(2) is not executed
There is something wrong with you just writing it like this
It should be
What should be passed here is a function name of the parent component method instead of writing alert(2) directly
This should be the problem
The following is a sub-component @change='showChange' is a sub-component event
The following template is registered as an order-type component
The following are sub-component methods: