Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev

 Conflicts:
	ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
	ruoyi-ui/src/router/index.js
This commit is contained in:
疯狂的狮子li
2021-07-24 19:03:36 +08:00
4 changed files with 16 additions and 6 deletions

View File

@ -87,7 +87,7 @@ export default {
// 默认激活的菜单
activeMenu() {
const path = this.$route.path;
let activePath = this.routers[0].path;
let activePath = this.defaultRouter();
if (path.lastIndexOf("/") > 0) {
const tmpPath = path.substring(1, path.length);
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
@ -100,7 +100,7 @@ export default {
}
var routes = this.activeRoutes(activePath);
if (routes.length === 0) {
activePath = this.currentIndex || this.routers[0].path
activePath = this.currentIndex || this.defaultRouter()
this.activeRoutes(activePath);
}
return activePath;
@ -121,6 +121,17 @@ export default {
const width = document.body.getBoundingClientRect().width / 3;
this.visibleNumber = parseInt(width / 85);
},
// 默认激活的路由
defaultRouter() {
let router;
Object.keys(this.routers).some((key) => {
if (!this.routers[key].hidden) {
router = this.routers[key].path;
return true;
}
});
return router;
},
// 菜单选择事件
handleSelect(key, keyPath) {
this.currentIndex = key;