Commit 4ce59807 by liimin

test

1 parent 4132e498
......@@ -4,8 +4,8 @@
* @Author: limin
* @Date: 2021-08-25 14:52:15
* @LastEditors: limin
* @LastEditTime: 2021-10-13 11:22:37
* @FilePath: \scrm\scrm-base\src\global\history.js
* @LastEditTime: 2023-09-19 11:18:00
* @FilePath: \scrm-base\src\global\history.js
*/
import store from '@/store'
import { utils } from 'glsx-common'
......@@ -36,8 +36,9 @@ function push(menu) {
if (!url) {
throw new Error('history.push:必须传入URL')
}
const to = store.getters.app.flatten.find(mod => url === mod.path || '/' + url === mod.path)
to && val(to)
const to = utils.array.valInDeep(store.getters.app.menuList, url, 'path', 'children') || []
// const to = store.getters.app.flatten.find(mod => url === mod.path || '/' + url === mod.path)
to[0] && val(to[0])
if (!url) {
throw new Error('跳转页面失败,请检查页面参数是否正确')
}
......
......@@ -20,8 +20,8 @@ export default {
handleSelect({ path, children = [] }) {
if (path) {
this.$router.push(path)
this.bus.$emit('menu3Changed', children.noHidden())
}
this.bus.$emit('menu3Changed', children.noHidden())
}
}
}
......
......@@ -10,6 +10,7 @@
<script>
import { currentId } from './mixins/index'
import { utils } from 'glsx-common'
export default {
name: 'MenuLv4',
inject: ['bus'],
......@@ -38,16 +39,18 @@ export default {
this.$nextTick(() => (this.activeName = sub.path))
}
},
find(id) {
return this.app.flatten.find(item => item.id == id)
},
onMenu3Changed(menus = []) {
this.setActive(menus[0]?.id, menus)
},
find(id) {
const item = utils.array.valInDeep(this.app.menuList, id, 'id', 'children') || []
return item[0]
},
onLoad() {
const { lv1, lv2, lv3, lv4 } = this.current
const lv3id = `${lv1}-${lv2}-${lv3}`
const lv4id = `${lv3id}-${lv4}`
console.log(lv4id)
const sub = this.find(lv3id)?.children
if (sub?.length) {
const nav4 = sub.noHidden()
......
......@@ -18,7 +18,7 @@ const app = {
},
SET_MENU_LIST(state, list) {
state.menuList = list
state.flatten = utils.array.flattenDeep(list)
// state.flatten = utils.array.flattenDeep(list)
},
SET_ROUTES(state, payload) {
state.routers = payload
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!