2
调用一个方法很建设vuejs组件
methods: {
filterPeople: function() {
console.log('hello')
//do some good stuff
},
},
beforeCreate() {
//do some ajax stuff
},
mounted() {
Event.$on('applied', function() {
console.log('the event is being caught')
this.filterPeople();
})
})
我得到的错误是
this.filterPeople(); is not a function
当我移动它的Event.$on
块它调用该方法之外。
这是如何工作的?
尼斯还没有真正做到ES6语法,但是这看起来整洁。 – LeBlaireau