| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <template>
- <a-layout id="app-demo-menu">
- <a-layout-sider
- theme="light"
- class="layout-sider"
- >
- <a-menu class="sub-menu-item" theme="light" mode="inline" :default-selected-keys="['menu_100']">
- <a-menu-item v-for="(menuInfo, subIndex) in menu" :key="subIndex">
- <router-link :to="{ name: menuInfo.pageName, params: menuInfo.params}">
- <span>{{ menuInfo.title }}</span>
- </router-link>
- </a-menu-item>
- </a-menu>
- </a-layout-sider>
- <a-layout>
- <a-layout-content>
- <router-view />
- </a-layout-content>
- </a-layout>
- </a-layout>
- </template>
- <script>
- export default {
- data() {
- return {
- menu: {
- 'menu_100' : {
- icon: 'profile',
- title: '文件',
- pageName: 'DemoFileIndex',
- params: {}
- },
- 'menu_300' : {
- icon: 'profile',
- title: '通信',
- pageName: 'DemoSocketIndex',
- params: {}
- },
- 'menu_500' : {
- icon: 'profile',
- title: '软件',
- pageName: 'DemoSoftwareIndex',
- params: {}
- },
- 'menu_600' : {
- icon: 'profile',
- title: '系统',
- pageName: 'DemoSystemIndex',
- params: {}
- },
- 'menu_800' : {
- icon: 'profile',
- title: '快捷键',
- pageName: 'DemoShortcutIndex',
- params: {}
- },
- 'menu_900' : {
- icon: 'profile',
- title: '测试',
- pageName: 'DemoTestApiIndex',
- params: {}
- },
- }
- };
- },
- created () {
- },
- mounted () {
- this.menuHandle({key: 'menu_100'})
- },
- methods: {
- menuHandle (item) {
- const linkInfo = this.menu[item.key]
- this.$router.push({ name: linkInfo.pageName, params: linkInfo.params})
- }
- }
- };
- </script>
- <style lang="less" scoped>
- #app-demo-menu {
- height: 100%;
- text-align: center;
- .layout-sider {
- border-top: 1px solid #e8e8e8;
- border-right: 0px solid #e8e8e8;
- background-color: #FAFAFA;
- }
- }
- </style>
|