路由处理
This commit is contained in:
parent
d8c44b2ef6
commit
b01ce00641
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
<script setup name="tags">
|
||||
import Sortable from 'sortablejs'
|
||||
import {getCurrentInstance, nextTick, ref, watch, onMounted} from "vue";
|
||||
import {getCurrentInstance, nextTick, ref, watch, onMounted, toRaw} from "vue";
|
||||
import store from "@/store/index";
|
||||
import {useRouter, useRoute} from "vue-router";
|
||||
import {getMenu} from "@/utils/route"
|
||||
|
|
@ -69,6 +69,7 @@ let contextMenuItem = ref(null)
|
|||
let left = ref(0)
|
||||
let top = ref(0)
|
||||
let tagList = store.state.viewTags.viewTags
|
||||
|
||||
let tipDisplayed = ref(false)
|
||||
|
||||
if (dashboardRoute) {
|
||||
|
|
@ -82,9 +83,8 @@ onMounted(() => {
|
|||
scrollInit()
|
||||
})
|
||||
|
||||
watch(route, (e) => {
|
||||
console.log(111)
|
||||
addViewTags(e);
|
||||
watch(() => route.path, (e) => {
|
||||
addViewTags(route);
|
||||
//判断标签容器是否出现滚动条
|
||||
nextTick(() => {
|
||||
const tags = proxy.$refs.tags
|
||||
|
|
@ -105,7 +105,7 @@ watch(route, (e) => {
|
|||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}, {deep: false})
|
||||
|
||||
watch(contextMenuVisible, (value) => {
|
||||
var cm = function (e) {
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ export default {
|
|||
let isName = route.name
|
||||
if(!target && isName){
|
||||
if(backPathIndex == -1){
|
||||
state.viewTags.push(route)
|
||||
state.viewTags.push(Object.assign({}, route))
|
||||
}else{
|
||||
state.viewTags.splice(backPathIndex+1, 0, route)
|
||||
state.viewTags.splice(backPathIndex+1, 0, Object.assign({}, route))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -25,12 +25,9 @@ export default {
|
|||
})
|
||||
},
|
||||
updateViewTags(state, route){
|
||||
// state.viewTags = state.viewTags.map(item =>
|
||||
// item.fullPath === route.fullPath ? { ...item, ...route } : item
|
||||
// );
|
||||
|
||||
state.viewTags.forEach((item) => {
|
||||
if (item.fullPath == route.fullPath){
|
||||
// 追加数据
|
||||
item = Object.assign(item, route)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@ export function beforeEach(to: RouteLocationNormalized, from: RouteLocationNorma
|
|||
if (!piMain) {
|
||||
return false
|
||||
}
|
||||
|
||||
console.log(from)
|
||||
|
||||
store.commit("updateViewTags", {
|
||||
fullPath: from.fullPath,
|
||||
scrollTop: piMain.scrollTop
|
||||
|
|
@ -28,7 +25,6 @@ export function afterEach(to: RouteLocationNormalized) {
|
|||
if (beforeRoute) {
|
||||
piMain.scrollTop = beforeRoute.scrollTop || 0
|
||||
}
|
||||
}).then(r => {
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue