Resolve warning: router with name dashboard not exist

pull/9/head
johnniang 2019-04-11 17:38:08 +08:00
parent abe5847711
commit ebb59569e7
2 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="logo">
<router-link :to="{name:'dashboard'}">
<router-link :to="{ name:'Dashboard' }">
<LogoSvg alt="logo" />
<h1 v-if="showTitle">{{ title }}</h1>
</router-link>

View File

@ -17,7 +17,7 @@ router.beforeEach((to, from, next) => {
if (Vue.ls.get(ACCESS_TOKEN)) {
/* has token */
if (to.path === '/user/login') {
next({ path: '/Dashboard' })
next({ name: 'Dashboard' })
NProgress.done()
} else {
if (store.getters.roles.length === 0) {
@ -85,18 +85,16 @@ const action = Vue.directive('action', {
const actionName = binding.arg
const roles = store.getters.roles
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 => {
if (!permissionId.includes(p.permissionId)) {
return
}
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 {
action
}
export { action }