mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2026-01-09 09:40:21 +08:00
fix: 解决vite5循环引用导致热更新失效问题
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
**********************************/
|
||||
|
||||
import { defineStore } from 'pinia'
|
||||
import { router } from '@/router'
|
||||
import { useRouterStore } from './router'
|
||||
|
||||
export const useTabStore = defineStore('tab', {
|
||||
state: () => ({
|
||||
@@ -55,13 +55,13 @@ export const useTabStore = defineStore('tab', {
|
||||
async removeTab(path) {
|
||||
this.setTabs(this.tabs.filter((tab) => tab.path !== path))
|
||||
if (path === this.activeTab) {
|
||||
router.push(this.tabs[this.tabs.length - 1].path)
|
||||
useRouterStore().router?.push(this.tabs[this.tabs.length - 1].path)
|
||||
}
|
||||
},
|
||||
removeOther(curPath = this.activeTab) {
|
||||
this.setTabs(this.tabs.filter((tab) => tab.path === curPath))
|
||||
if (curPath !== this.activeTab) {
|
||||
router.push(this.tabs[this.tabs.length - 1].path)
|
||||
useRouterStore().router?.push(this.tabs[this.tabs.length - 1].path)
|
||||
}
|
||||
},
|
||||
removeLeft(curPath) {
|
||||
@@ -69,7 +69,7 @@ export const useTabStore = defineStore('tab', {
|
||||
const filterTabs = this.tabs.filter((item, index) => index >= curIndex)
|
||||
this.setTabs(filterTabs)
|
||||
if (!filterTabs.find((item) => item.path === this.activeTab)) {
|
||||
router.push(filterTabs[filterTabs.length - 1].path)
|
||||
useRouterStore().router?.push(filterTabs[filterTabs.length - 1].path)
|
||||
}
|
||||
},
|
||||
removeRight(curPath) {
|
||||
@@ -77,7 +77,7 @@ export const useTabStore = defineStore('tab', {
|
||||
const filterTabs = this.tabs.filter((item, index) => index <= curIndex)
|
||||
this.setTabs(filterTabs)
|
||||
if (!filterTabs.find((item) => item.path === this.activeTab.value)) {
|
||||
router.push(filterTabs[filterTabs.length - 1].path)
|
||||
useRouterStore().router?.push(filterTabs[filterTabs.length - 1].path)
|
||||
}
|
||||
},
|
||||
resetTabs() {
|
||||
|
||||
Reference in New Issue
Block a user