|
|
@@ -4,7 +4,7 @@
|
|
|
theme="light"
|
|
|
class="layout-sider"
|
|
|
>
|
|
|
- <a-menu theme="light" mode="inline" :default-selected-keys="['menu_100']">
|
|
|
+ <a-menu theme="light" mode="inline" :default-selected-keys="[default_key]" :selected-keys="[current]" @click="menuClick">
|
|
|
<a-menu-item v-for="(menuInfo, subIndex) in menu" :key="subIndex">
|
|
|
<router-link :to="{ name: menuInfo.pageName, params: menuInfo.params}">
|
|
|
<span>{{ menuInfo.title }}</span>
|
|
|
@@ -20,95 +20,50 @@
|
|
|
</a-layout>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import subMenu from '@/config/subMenu'
|
|
|
+
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ id: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- menu: {
|
|
|
- 'menu_100' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '文件',
|
|
|
- pageName: 'BaseFileIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_300' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '通信',
|
|
|
- pageName: 'BaseSocketIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_301' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '数据库',
|
|
|
- pageName: 'BaseDBIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_400' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '视图',
|
|
|
- pageName: 'BaseWindowViewIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_401' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '窗口',
|
|
|
- pageName: 'BaseWindowIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_405' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '桌面通知',
|
|
|
- pageName: 'BaseNotificationIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_407' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '电源监控',
|
|
|
- pageName: 'BasePowerMonitorIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_409' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '屏幕信息',
|
|
|
- pageName: 'BaseScreenIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_411' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '系统主题',
|
|
|
- pageName: 'BaseThemeIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_412' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '自动更新',
|
|
|
- pageName: 'BaseUpdaterIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_500' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '软件调用',
|
|
|
- pageName: 'BaseSoftwareIndex',
|
|
|
- params: {}
|
|
|
- },
|
|
|
- 'menu_900' : {
|
|
|
- icon: 'profile',
|
|
|
- title: '测试',
|
|
|
- pageName: 'BaseTestApiIndex',
|
|
|
- params: {}
|
|
|
- }
|
|
|
- }
|
|
|
+ menu:{},
|
|
|
+ default_key: 'menu_100',
|
|
|
+ current: '',
|
|
|
+ keys: []
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ id: function () {
|
|
|
+ this.menuHandle();
|
|
|
+ },
|
|
|
+ },
|
|
|
created () {
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.menuHandle({key: 'menu_100'})
|
|
|
+ this.menuHandle();
|
|
|
},
|
|
|
methods: {
|
|
|
- menuHandle (item) {
|
|
|
- const linkInfo = this.menu[item.key]
|
|
|
- this.$router.push({ name: linkInfo.pageName, params: linkInfo.params})
|
|
|
- }
|
|
|
+ menuHandle () {
|
|
|
+ this.current = this.default_key;
|
|
|
+ switch (this.id) {
|
|
|
+ case 'base' :
|
|
|
+ this.menu = subMenu.base;
|
|
|
+ break;
|
|
|
+ case 'other' :
|
|
|
+ this.menu = subMenu.other;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ const linkInfo = this.menu[this.current];
|
|
|
+ this.$router.push({ name: linkInfo.pageName, params: linkInfo.params});
|
|
|
+ },
|
|
|
+ menuClick(e) {
|
|
|
+ this.current = e.key;
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|