拦截路由
This commit is contained in:
+11
-2
@@ -66,13 +66,22 @@ import { Loading } from 'element-ui';
|
||||
|
||||
// 路由拦截
|
||||
router.beforeEach(function (to, from, next) {
|
||||
const currentURL = window.location.href
|
||||
if (currentURL.indexOf('#/') > 0) {
|
||||
const index = currentURL.indexOf('#/')
|
||||
const startUrl = currentURL.slice(0, index)
|
||||
const endUrl = currentURL.slice(index + 2)
|
||||
window.location.href = startUrl + endUrl
|
||||
}
|
||||
let loading = Loading.service({
|
||||
text: '加载中...',
|
||||
background: '#fff'
|
||||
});
|
||||
function closeLoading(){
|
||||
loading.close()
|
||||
loading = null
|
||||
setTimeout(() => {
|
||||
loading.close()
|
||||
loading = null
|
||||
}, 1000)
|
||||
}
|
||||
let fromName = from.name
|
||||
if(fromName === undefined || fromName === null){
|
||||
|
||||
Reference in New Issue
Block a user