Explorar el Código

修复关闭左侧标签报错问题

RuoYi hace 3 años
padre
commit
56563b4f8e
Se han modificado 1 ficheros con 15 adiciones y 12 borrados
  1. 15 12
      src/store/modules/tagsView.js

+ 15 - 12
src/store/modules/tagsView.js

@@ -132,19 +132,22 @@ const useTagsViewStore = defineStore(
         })
       },
       delLeftTags(view) {
-        const index = this.visitedViews.findIndex(v => v.path === view.path)
-        if (index === -1) {
-          return
-        }
-        this.visitedViews = this.visitedViews.filter((item, idx) => {
-          if (idx >= index || (item.meta && item.meta.affix)) {
-            return true
-          }
-          const i = this.cachedViews.indexOf(item.name)
-          if (i > -1) {
-            this.cachedViews.splice(i, 1)
+        return new Promise(resolve => {
+          const index = this.visitedViews.findIndex(v => v.path === view.path)
+          if (index === -1) {
+            return
           }
-          return false
+          this.visitedViews = this.visitedViews.filter((item, idx) => {
+            if (idx >= index || (item.meta && item.meta.affix)) {
+              return true
+            }
+            const i = this.cachedViews.indexOf(item.name)
+            if (i > -1) {
+              this.cachedViews.splice(i, 1)
+            }
+            return false
+          })
+          resolve([...this.visitedViews])
         })
       }
     }