// temp.vue export default { name: 'temp', mounted (){ console.log(this) }, methods:{ click:()=>{console.log(this)} } }
起因是想使用vuex在组件点击事件回调中提交 Mutation,结果会报错(找不到commit方法,vuex已经成功引入并注入根组件,mounted钩子里获取this.$store都正常)
打印了下mounted钩子和计算属性里面的this都是 VueComponent
而点击事件回调this
请问这两个this有什么区别吗?
安静的沙漠
相关分类