修复右击刷新选项卡404的问题
This commit is contained in:
@@ -35,6 +35,17 @@ export const constantRouterMap = [
|
|||||||
component: () => import('@/views/errorPage/401'),
|
component: () => import('@/views/errorPage/401'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/redirect',
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/redirect/:path*',
|
||||||
|
component: () => import('@/views/redirect/index')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
</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)">刷新</li>
|
||||||
<li @click="closeSelectedTag(selectedTag)">关闭</li>
|
<li @click="closeSelectedTag(selectedTag)">关闭</li>
|
||||||
<li @click="closeOthersTags">关闭其他</li>
|
<li @click="closeOthersTags">关闭其他</li>
|
||||||
<li @click="closeAllTags">关闭所有</li>
|
<li @click="closeAllTags">关闭所有</li>
|
||||||
@@ -85,6 +86,16 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
refreshSelectedTag(view) {
|
||||||
|
this.$store.dispatch('delCachedView', view).then(() => {
|
||||||
|
const { fullPath } = view
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$router.replace({
|
||||||
|
path: '/redirect' + fullPath
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
closeSelectedTag(view) {
|
closeSelectedTag(view) {
|
||||||
this.$store.dispatch('delView', view).then(({ visitedViews }) => {
|
this.$store.dispatch('delView', view).then(({ visitedViews }) => {
|
||||||
if (this.isActive(view)) {
|
if (this.isActive(view)) {
|
||||||
|
|||||||
12
src/views/redirect/index.vue
Normal file
12
src/views/redirect/index.vue
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
beforeCreate() {
|
||||||
|
const { params, query } = this.$route
|
||||||
|
const { path } = params
|
||||||
|
this.$router.replace({ path: '/' + path, query })
|
||||||
|
},
|
||||||
|
render: function(h) {
|
||||||
|
return h() // avoid warning message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user