我在vue中有一个非常直接的组件,它在组件加载后从挂载的挂钩执行一个函数。
methods: {
pushFolders: function() {
$.each(this.$store.state.folders.subFolders, function(key, value) {
this.selected.push(value.uuid)
}.bind(this));
},
checkAll: function(){
this.isSelectedAll = !this.isSelectedAll;
this.selectedFolders = [];
if(this.isSelectedAll){ // Check all
// this.selectedFolders.push(this.selected[key]);
this.$store.dispatch('SELECT_FOLDERS',this.selected)
}
}
},
mounted: function() {
this.pushFolders()
}
当我加载组件所在的路径时,我收到此错误:
Error in mounted hook: "TypeError: e is undefined"
任何人都可以对此有所了解吗?