Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for (const tag of tags) 报错 #1

Open
laqudee opened this issue Jan 27, 2021 · 0 comments
Open

for (const tag of tags) 报错 #1

laqudee opened this issue Jan 27, 2021 · 0 comments

Comments

@laqudee
Copy link

laqudee commented Jan 27, 2021

在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)
            }
            
          }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant