在Vue.js项目中,我无法从方法内的函数访问属性=> this.ws_files。该属性可以在mount()中访问,但不能在方法中访问。
下面是代码段:
export default {
name: 'file-list',
data () {
return {
title: pageName,
ws_files: "AB"
}
},
mounted () {
this.getFolderInfo('ZEST/ZEST Negoce/',10)
},
methods: {
getFolderInfo: (folderName,maxKeys) => {
this.ws_files = "Sant"
}
}
}
答案 0 :(得分:1)
您的问题与this question相同。
您不应使用() => {}
语法定义方法。
执行此操作:
getFolderInfo(folderName, maxKeys) {
this.ws_files = "Sant"
}