mirror of https://github.com/halo-dev/halo-admin
Resolve warning: router with name dashboard not exist
parent
abe5847711
commit
ebb59569e7
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<router-link :to="{name:'dashboard'}">
|
<router-link :to="{ name:'Dashboard' }">
|
||||||
<LogoSvg alt="logo" />
|
<LogoSvg alt="logo" />
|
||||||
<h1 v-if="showTitle">{{ title }}</h1>
|
<h1 v-if="showTitle">{{ title }}</h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
|
@ -17,7 +17,7 @@ router.beforeEach((to, from, next) => {
|
||||||
if (Vue.ls.get(ACCESS_TOKEN)) {
|
if (Vue.ls.get(ACCESS_TOKEN)) {
|
||||||
/* has token */
|
/* has token */
|
||||||
if (to.path === '/user/login') {
|
if (to.path === '/user/login') {
|
||||||
next({ path: '/Dashboard' })
|
next({ name: 'Dashboard' })
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
} else {
|
} else {
|
||||||
if (store.getters.roles.length === 0) {
|
if (store.getters.roles.length === 0) {
|
||||||
|
@ -85,18 +85,16 @@ const action = Vue.directive('action', {
|
||||||
const actionName = binding.arg
|
const actionName = binding.arg
|
||||||
const roles = store.getters.roles
|
const roles = store.getters.roles
|
||||||
const elVal = vnode.context.$route.meta.permission
|
const elVal = vnode.context.$route.meta.permission
|
||||||
const permissionId = elVal instanceof String && [elVal] || elVal
|
const permissionId = (elVal instanceof String && [elVal]) || elVal
|
||||||
roles.permissions.forEach(p => {
|
roles.permissions.forEach(p => {
|
||||||
if (!permissionId.includes(p.permissionId)) {
|
if (!permissionId.includes(p.permissionId)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (p.actionList && !p.actionList.includes(actionName)) {
|
if (p.actionList && !p.actionList.includes(actionName)) {
|
||||||
el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none')
|
;(el.parentNode && el.parentNode.removeChild(el)) || (el.style.display = 'none')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export {
|
export { action }
|
||||||
action
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue