在组件中,当调用$emit('callback', params)完成时,我需要返回值。有人可以帮忙吗?
Vue 组件:
methods: {
test: function () {
if(this.$emit('cb', param1)){
// this not working
console.log('return true')
}else{
console.log('return false')
}
}
}
Run Code Online (Sandbox Code Playgroud)
vueRoot:
methods: {
cb: function () {
return true;
}
}
Run Code Online (Sandbox Code Playgroud)