fix刷新标签页空白问题

This commit is contained in:
不做码农 2022-05-25 14:43:13 +08:00
parent c1896bb01d
commit 1dce2479b0
3 changed files with 18 additions and 16 deletions

View File

@ -5,7 +5,7 @@
v-for="tag in visitedViews"
:key="tag.path"
:data-path="tag.path"
:class="isActive(tag) ? 'active' : ''"
:class="{ active: isActive(tag) }"
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
class="tags-view-item"
:style="activeStyle(tag)"
@ -19,7 +19,10 @@
</router-link>
</scroll-pane>
<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)">
<close style="width: 1em; height: 1em" /> {{ $t('tagsView.close') }}
</li>
@ -49,7 +52,7 @@ const router = useRouter()
const visitedViews = computed(() => store.state.tagsView.visitedViews)
const routes = computed(() => store.state.permission.routes)
const theme = computed(() => store.state.settings.theme)
// const theme = computed(() => store.state.settings.theme)
watch(route, () => {
addTags()
@ -147,7 +150,7 @@ function moveToCurrentTag() {
}
function refreshSelectedTag(view) {
proxy.$tab.refreshPage(view)
console.log(view)
// In order to make the cached page re-rendered
}
function closeSelectedTag(view) {
proxy.$tab.closePage(view).then(({ visitedViews }) => {

View File

@ -1,6 +1,6 @@
import store from '@/store'
import router from '@/router'
import { nextTick } from 'vue'
export default {
// 刷新当前tab页签
refreshPage(obj) {
@ -14,15 +14,13 @@ export default {
}
});
}
store.dispatch('tagsView/delCachedView', obj).then(() => {
const { fullPath, query } = obj
nextTick(() => {
return store.dispatch('tagsView/delCachedView', obj).then(() => {
const { path, query } = obj
router.replace({
path: '/redirect' + fullPath,
path: '/redirect' + path,
query: query
})
})
})
},
// 关闭当前tab页签打开新页签
closeOpenPage(obj) {

View File

@ -1,11 +1,12 @@
<template>
<div></div>
</template>
<!-- 这里有坑 template里面要有div标签不然页面会出现各种问题-->
<script setup>
import { useRoute, useRouter } from 'vue-router'
const route = useRoute();
const router = useRouter();
const route = useRoute()
const router = useRouter()
const { params, query } = route
const { path } = params