我使用 Vue-Dragula 进行拖放。当我放下时,它会触发该方法:
mounted: function () {
this.$nextTick(function () {
Vue.vueDragula.eventBus.$on(
'drop',
function (args) {
console.log(this.championship);
}
);
}
现在this.championship
是一个计算属性:
computed: {
championship(){
return this.championships.find((elem) => elem.championship == this.championship_id);
},
}
wherechampionships
和championship_id
是全局数据。
并console.log(this.championship);
返回undefined
现在,我简化,我写:
computed: {
championship(){
return 2;
},
}
并console.log(this.championship);
继续返回undefined
我的代码有什么问题???