element3-admin
element3-admin copied to clipboard
for (const tag of tags) 报错
在src/layout/components/TagsView/index.vue中,line 115,运行报错,使用for of 遍历对象,出错... Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.
我的解决方案:
for (const index of Object.keys(tags)) {
// console.log(tags[index]);
let tag = tags[index]
console.log('tag: ', tag);
if (!tag) return
if (tag.path === this.$route.path) {
this.$refs.scrollPane.moveToTarget(tag)
// when query is different then update
if (tag.fullPath !== this.$route.fullPath) {
this.$store.dispatch('tagsView/updateVisitedView', this.$route)
}
}
}