gpt4 book ai didi

javascript - 为什么我在安装的钩子(Hook) : "TypeError: e is undefined"? 中出现错误

转载 作者:行者123 更新时间:2023-11-30 20:33:54 25 4
gpt4 key购买 nike

我在 vue 中有一个非常简单的组件,它会在组件加载后从挂载的钩子(Hook)执行一个函数。

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"

任何人都可以阐明这一点吗?

最佳答案

你可以试试nextTick(找到解决方案 here)

关于javascript - 为什么我在安装的钩子(Hook) : "TypeError: e is undefined"? 中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50038822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com