diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue deleted file mode 100644 index 8035beb..0000000 --- a/src/layout/components/AppMain.vue +++ /dev/null @@ -1,20 +0,0 @@ - - diff --git a/src/layout/components/IframeToggle/index.vue b/src/layout/components/IframeToggle/index.vue new file mode 100644 index 0000000..3962536 --- /dev/null +++ b/src/layout/components/IframeToggle/index.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/layout/components/InnerLink/index.vue b/src/layout/components/InnerLink/index.vue index 2e7528d..eca14f1 100644 --- a/src/layout/components/InnerLink/index.vue +++ b/src/layout/components/InnerLink/index.vue @@ -1,30 +1,42 @@ - diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 9d8e587..53ba73c 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -40,7 +40,7 @@ import { getNormalPath } from '@/utils/ruoyi' import useTagsViewStore from '@/store/modules/tagsView' // import useSettingsStore from '@/store/modules/settings' import usePermissionStore from '@/store/modules/permission' - +import { isHttp } from '@/utils/validate' const visible = ref(false) const top = ref(0) const left = ref(0) @@ -108,7 +108,7 @@ function filterAffixTags(routes, basePath = '') { fullPath: tagPath, path: tagPath, name: route.name, - meta: { ...route.meta }, + meta: { ...route.meta } }) } if (route.children) { @@ -134,6 +134,10 @@ function addTags() { const { name } = route if (name) { useTagsViewStore().addView(route) + if (route.meta.link && isHttp(route.meta.link)) { + console.log('add link', route.meta.link) + useTagsViewStore().addIframeView(route) + } } return false } @@ -152,7 +156,9 @@ function moveToCurrentTag() { } function refreshSelectedTag(view) { proxy.$tab.refreshPage(view) - // In order to make the cached page re-rendered + if (route.meta.link) { + useTagsViewStore().delIframeView(route) + } } function closeSelectedTag(view) { proxy.$tab.closePage(view).then(({ visitedViews }) => { diff --git a/src/layout/index.vue b/src/layout/index.vue index 8acd4bc..d501bc8 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -15,10 +15,11 @@ - + +
@@ -33,7 +34,7 @@ import { useWindowSize } from '@vueuse/core' import Sidebar from './components/Sidebar/index.vue' import { Navbar, Settings, TagsView } from './components' import defaultSettings from '@/settings' - +import iframeToggle from './components/IframeToggle/index' import useAppStore from '@/store/modules/app' import useSettingsStore from '@/store/modules/settings' import useTagsViewStore from '@/store/modules/tagsView' diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index 0a30d00..93ae11a 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -1,13 +1,22 @@ const useTagsViewStore = defineStore('tagsView', { state: () => ({ visitedViews: [], - cachedViews: [] + cachedViews: [], + iframeViews: [] }), actions: { addView(view) { this.addVisitedView(view) this.addCachedView(view) }, + addIframeView(view) { + if (this.iframeViews.some((v) => v.path === view.path)) return + this.iframeViews.push( + Object.assign({}, view, { + title: view.meta.title || 'no-name' + }) + ) + }, addVisitedView(view) { if (this.visitedViews.some((v) => v.path === view.path)) return this.visitedViews.push( @@ -40,9 +49,16 @@ const useTagsViewStore = defineStore('tagsView', { break } } + this.iframeViews = this.iframeViews.filter((item) => item.path !== view.path) resolve([...this.visitedViews]) }) }, + delIframeView(view) { + return new Promise((resolve) => { + this.iframeViews = this.iframeViews.filter((item) => item.path !== view.path) + resolve([...this.iframeViews]) + }) + }, delCachedView(view) { return new Promise((resolve) => { const index = this.cachedViews.indexOf(view.name) @@ -65,6 +81,7 @@ const useTagsViewStore = defineStore('tagsView', { this.visitedViews = this.visitedViews.filter((v) => { return v.meta.affix || v.path === view.path }) + this.iframeViews = this.iframeViews.filter((item) => item.path === view.path) resolve([...this.visitedViews]) }) }, @@ -93,6 +110,7 @@ const useTagsViewStore = defineStore('tagsView', { return new Promise((resolve) => { const affixTags = this.visitedViews.filter((tag) => tag.meta.affix) this.visitedViews = affixTags + this.iframeViews = [] resolve([...this.visitedViews]) }) }, @@ -124,6 +142,10 @@ const useTagsViewStore = defineStore('tagsView', { if (i > -1) { this.cachedViews.splice(i, 1) } + if (item.meta.link) { + const fi = this.iframeViews.findIndex((v) => v.path === item.path) + this.iframeViews.splice(fi, 1) + } return false }) resolve([...this.visitedViews]) @@ -143,6 +165,10 @@ const useTagsViewStore = defineStore('tagsView', { if (i > -1) { this.cachedViews.splice(i, 1) } + if (item.meta.link) { + const fi = this.iframeViews.findIndex((v) => v.path === item.path) + this.iframeViews.splice(fi, 1) + } return false }) resolve([...this.visitedViews])