福州一menuBar 调整
This commit is contained in:
parent
00c2dfc377
commit
6601bdac1b
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
|
||||
import { menuBarConvert } from '@/scripts/MenuContextHandler';
|
||||
import EachChildMenu from './eachChildMenu';
|
||||
|
||||
export default {
|
||||
@ -64,7 +64,7 @@ export default {
|
||||
return true;
|
||||
},
|
||||
initMenu() {
|
||||
// this.menu = MenuContextHandler.menuBarConvert(this.menuNormal, this.$store.state.training.operatemode);
|
||||
this.menu = menuBarConvert(this.menuNormal, this.$store.state.training.operatemode);
|
||||
},
|
||||
noShowingChildren(children) {
|
||||
if (!children || children.length <= 0) {
|
||||
|
39
src/scripts/MenuContextHandler.js
Normal file
39
src/scripts/MenuContextHandler.js
Normal file
@ -0,0 +1,39 @@
|
||||
import { OperateMode } from '@/scripts/ConstDic';
|
||||
|
||||
export function menuBarConvert(menu, mode) {
|
||||
if (menu) {
|
||||
if (mode === OperateMode.NORMAL) {
|
||||
menu.forEach(item => {
|
||||
if (item.type === 'separator') {
|
||||
item.show = true;
|
||||
return;
|
||||
}
|
||||
|
||||
item.show = false;
|
||||
if (!item.click) {
|
||||
item.click = () => { };
|
||||
}
|
||||
|
||||
if (!item.force) {
|
||||
item.show = true;
|
||||
if (item.children && item.children.length > 0) {
|
||||
this.menuBarConvert(item.children, mode);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (mode === OperateMode.ADMIN) {
|
||||
menu.forEach(item => {
|
||||
item.show = true;
|
||||
if (!item.click) {
|
||||
item.click = () => { };
|
||||
}
|
||||
|
||||
if (item.children && item.children.length > 0) {
|
||||
this.menuBarConvert(item.children, mode);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return menu || [];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user