Skip to content

for (const tag of tags) 报错 #1

Description

@laqudee

在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)
            }
            
          }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions