This commit is contained in:
parent
fb3e58ef11
commit
5c3bb39ff0
|
@ -5,6 +5,7 @@ import NProgress from 'nprogress'
|
||||||
import 'nprogress/nprogress.css'
|
import 'nprogress/nprogress.css'
|
||||||
import tool from '@/utils/tool';
|
import tool from '@/utils/tool';
|
||||||
import systemRouter from './systemRouter';
|
import systemRouter from './systemRouter';
|
||||||
|
import {beforeEach, afterEach} from './scrollBehavior';
|
||||||
|
|
||||||
//系统路由
|
//系统路由
|
||||||
const routes = systemRouter
|
const routes = systemRouter
|
||||||
|
@ -60,10 +61,12 @@ router.beforeEach(async (to, from, next) => {
|
||||||
}
|
}
|
||||||
isGetApiRouter = true;
|
isGetApiRouter = true;
|
||||||
}
|
}
|
||||||
|
beforeEach(to, from)
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach((to, from) => {
|
||||||
|
afterEach(to, from)
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import store from '@/store'
|
||||||
|
import { nextTick } from 'vue'
|
||||||
|
|
||||||
|
export function beforeEach(to, from){
|
||||||
|
var adminMain = document.querySelector('#adminui-main')
|
||||||
|
if(!adminMain){return false}
|
||||||
|
store.commit("updateViewTags", {
|
||||||
|
fullPath: from.fullPath,
|
||||||
|
scrollTop: adminMain.scrollTop
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function afterEach(to){
|
||||||
|
var adminMain = document.querySelector('#adminui-main')
|
||||||
|
if(!adminMain){return false}
|
||||||
|
nextTick(()=>{
|
||||||
|
var beforeRoute = store.state.viewTags.viewTags.filter(v => v.fullPath == to.fullPath)[0]
|
||||||
|
adminMain.scrollTop = beforeRoute.scrollTop || 0
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue