fix刷新标签页空白问题
This commit is contained in:
parent
c1896bb01d
commit
1dce2479b0
@ -5,7 +5,7 @@
|
|||||||
v-for="tag in visitedViews"
|
v-for="tag in visitedViews"
|
||||||
:key="tag.path"
|
:key="tag.path"
|
||||||
:data-path="tag.path"
|
:data-path="tag.path"
|
||||||
:class="isActive(tag) ? 'active' : ''"
|
:class="{ active: isActive(tag) }"
|
||||||
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
|
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
|
||||||
class="tags-view-item"
|
class="tags-view-item"
|
||||||
:style="activeStyle(tag)"
|
:style="activeStyle(tag)"
|
||||||
@ -19,7 +19,10 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</scroll-pane>
|
</scroll-pane>
|
||||||
<ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
|
<ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
|
||||||
<li @click="refreshSelectedTag(selectedTag)"><refresh-right style="width: 1em; height: 1em" /> {{ $t('tagsView.refresh') }}</li>
|
<li @click="refreshSelectedTag(selectedTag)" v-if="isActive(selectedTag)">
|
||||||
|
<refresh-right style="width: 1em; height: 1em" />
|
||||||
|
{{ $t('tagsView.refresh') }}
|
||||||
|
</li>
|
||||||
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
|
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
|
||||||
<close style="width: 1em; height: 1em" /> {{ $t('tagsView.close') }}
|
<close style="width: 1em; height: 1em" /> {{ $t('tagsView.close') }}
|
||||||
</li>
|
</li>
|
||||||
@ -49,7 +52,7 @@ const router = useRouter()
|
|||||||
|
|
||||||
const visitedViews = computed(() => store.state.tagsView.visitedViews)
|
const visitedViews = computed(() => store.state.tagsView.visitedViews)
|
||||||
const routes = computed(() => store.state.permission.routes)
|
const routes = computed(() => store.state.permission.routes)
|
||||||
const theme = computed(() => store.state.settings.theme)
|
// const theme = computed(() => store.state.settings.theme)
|
||||||
|
|
||||||
watch(route, () => {
|
watch(route, () => {
|
||||||
addTags()
|
addTags()
|
||||||
@ -147,7 +150,7 @@ function moveToCurrentTag() {
|
|||||||
}
|
}
|
||||||
function refreshSelectedTag(view) {
|
function refreshSelectedTag(view) {
|
||||||
proxy.$tab.refreshPage(view)
|
proxy.$tab.refreshPage(view)
|
||||||
console.log(view)
|
// In order to make the cached page re-rendered
|
||||||
}
|
}
|
||||||
function closeSelectedTag(view) {
|
function closeSelectedTag(view) {
|
||||||
proxy.$tab.closePage(view).then(({ visitedViews }) => {
|
proxy.$tab.closePage(view).then(({ visitedViews }) => {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { nextTick } from 'vue'
|
|
||||||
export default {
|
export default {
|
||||||
// 刷新当前tab页签
|
// 刷新当前tab页签
|
||||||
refreshPage(obj) {
|
refreshPage(obj) {
|
||||||
@ -14,13 +14,11 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
store.dispatch('tagsView/delCachedView', obj).then(() => {
|
return store.dispatch('tagsView/delCachedView', obj).then(() => {
|
||||||
const { fullPath, query } = obj
|
const { path, query } = obj
|
||||||
nextTick(() => {
|
router.replace({
|
||||||
router.replace({
|
path: '/redirect' + path,
|
||||||
path: '/redirect' + fullPath,
|
query: query
|
||||||
query: query
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div></div>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- !!!这里有坑 template里面要有div标签,不然页面会出现各种问题-->
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute()
|
||||||
const router = useRouter();
|
const router = useRouter()
|
||||||
const { params, query } = route
|
const { params, query } = route
|
||||||
const { path } = params
|
const { path } = params
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user