ant-design-vue/components/menu/demo/inline-collapsed.vue

78 lines
2.0 KiB
Vue
Raw Normal View History

2018-01-17 11:15:18 +00:00
<template>
<div>
<md>
## 缩起内嵌菜单
内嵌菜单可以被缩起/展开
你可以在 [Layout](/components/layout/#components-layout-demo-side)
</md>
<div style="width: 256px">
2018-01-23 10:55:39 +00:00
<a-button type="primary" @click="toggleCollapsed" style="margin-bottom: 16px">
2018-01-17 11:15:18 +00:00
<Icon :type="collapsed ? 'menu-unfold' : 'menu-fold'" />
2018-01-23 10:55:39 +00:00
</a-button>
2018-01-17 11:15:18 +00:00
<Menu
:defaultSelectedKeys="['1']"
:defaultOpenKeys="['sub1']"
mode="inline"
theme="dark"
:inlineCollapsed="collapsed"
>
2018-01-18 10:58:36 +00:00
<MenuItem key="1">
2018-01-17 11:15:18 +00:00
<Icon type="pie-chart" />
<span>Option 1</span>
2018-01-18 10:58:36 +00:00
</MenuItem>
<MenuItem key="2">
2018-01-17 11:15:18 +00:00
<Icon type="desktop" />
<span>Option 2</span>
</MenuItem>
<MenuItem key="3">
<Icon type="inbox" />
<span>Option 3</span>
</MenuItem>
<SubMenu key="sub1">
2018-01-19 03:47:06 +00:00
<span slot="title"><Icon type="mail" /><span>Navigation One</span></span>
2018-01-17 11:15:18 +00:00
<MenuItem key="5">Option 5</MenuItem>
<MenuItem key="6">Option 6</MenuItem>
<MenuItem key="7">Option 7</MenuItem>
<MenuItem key="8">Option 8</MenuItem>
</SubMenu>
<SubMenu key="sub2">
2018-01-19 03:47:06 +00:00
<span slot="title"><Icon type="appstore" /><span>Navigation Two</span></span>
2018-01-17 11:15:18 +00:00
<MenuItem key="9">Option 9</MenuItem>
<MenuItem key="10">Option 10</MenuItem>
<SubMenu key="sub3" title="Submenu">
<MenuItem key="11">Option 11</MenuItem>
<MenuItem key="12">Option 12</MenuItem>
</SubMenu>
2018-01-18 10:58:36 +00:00
</SubMenu>
2018-01-17 11:15:18 +00:00
</Menu>
</div>
</div>
</template>
<script>
import { Menu, Icon, Button } from 'antd'
const SubMenu = Menu.SubMenu
const MenuItemGroup = Menu.ItemGroup
const MenuItem = Menu.Item
export default {
data () {
return {
2018-01-19 10:01:43 +00:00
collapsed: false,
2018-01-17 11:15:18 +00:00
}
},
methods: {
toggleCollapsed () {
this.collapsed = !this.collapsed
},
},
components: {
Menu,
Icon,
SubMenu,
MenuItemGroup,
MenuItem,
2018-01-23 10:55:39 +00:00
2018-01-17 11:15:18 +00:00
},
}
</script>