vue-property-decorator
vue-property-decorator copied to clipboard
How does @emit guarantee the execution order of functions
in vue2.x
// Parent
<div @hello="sayHello"></div>
export default {
method: {
sayHello() {
console.log('hello')
}
}
}
// Child
export default {
methods: {
sayWorld() {
console.log('hi')
this.$emit('hello')
console.log('world')
}
}
}
Trigger the event, output hi hello world
in vue.2x by ts
// Child
@Component
export default class World extend Vue{
@Emit()
sayWorld() {
console.log('hi')
console.log('world')
}
}
Trigger the event, outpu hello hi world
I want to know how @emit guarantees execution order hi hello world