后台管理系统高亮效果
多级路由的path匹配问题 导致高亮效果失效 解决:
export function isExternal(path) {
return /^(https?:|mailto:|tel:)/.test(path)
}
//引入path和上面的正则函数
import path from 'path'
//返回的值:index绑定
resolvePath(routePath) {
if (isExternal(routePath)) {
return routePath
}
if (isExternal(this.basePath)) {
return this.basePath
}
return path.resolve(this.basePath, routePath)
}
绑定菜单item中 index动态绑定 达到效果