ant-design-vue/components/layout/demo/custom-trigger.md

76 lines
1.8 KiB
Markdown
Raw Normal View History

2018-04-20 04:52:31 +00:00
<cn>
#### 自定义触发器
要使用自定义触发器,可以设置 `:trigger="null"` 来隐藏默认设定。
</cn>
<us>
#### Custom trigger
If you want to use a customized trigger, you can hide the default one by setting `:trigger="null"`.
</us>
2019-10-09 10:32:23 +00:00
```tpl
2018-04-20 04:52:31 +00:00
<template>
<a-layout id="components-layout-demo-custom-trigger">
2019-09-28 12:45:07 +00:00
<a-layout-sider :trigger="null" collapsible v-model="collapsed">
2018-04-20 04:52:31 +00:00
<div class="logo" />
2018-04-20 08:58:40 +00:00
<a-menu theme="dark" mode="inline" :defaultSelectedKeys="['1']">
2018-04-20 04:52:31 +00:00
<a-menu-item key="1">
<a-icon type="user" />
<span>nav 1</span>
</a-menu-item>
<a-menu-item key="2">
<a-icon type="video-camera" />
<span>nav 2</span>
</a-menu-item>
<a-menu-item key="3">
<a-icon type="upload" />
<span>nav 3</span>
</a-menu-item>
</a-menu>
</a-layout-sider>
<a-layout>
2018-04-20 08:58:40 +00:00
<a-layout-header style="background: #fff; padding: 0">
2018-04-20 04:52:31 +00:00
<a-icon
class="trigger"
:type="collapsed ? 'menu-unfold' : 'menu-fold'"
@click="()=> collapsed = !collapsed"
/>
2018-04-20 08:58:40 +00:00
</a-layout-header>
2019-09-28 12:45:07 +00:00
<a-layout-content
:style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }"
>
2018-04-20 04:52:31 +00:00
Content
</a-layout-content>
</a-layout>
</a-layout>
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
data() {
return {
collapsed: false,
};
},
};
2018-04-20 04:52:31 +00:00
</script>
<style>
2019-09-28 12:45:07 +00:00
#components-layout-demo-custom-trigger .trigger {
font-size: 18px;
line-height: 64px;
padding: 0 24px;
cursor: pointer;
transition: color 0.3s;
}
2018-04-20 04:52:31 +00:00
2019-09-28 12:45:07 +00:00
#components-layout-demo-custom-trigger .trigger:hover {
color: #1890ff;
}
2018-04-20 04:52:31 +00:00
2019-09-28 12:45:07 +00:00
#components-layout-demo-custom-trigger .logo {
height: 32px;
background: rgba(255, 255, 255, 0.2);
margin: 16px;
}
2018-04-20 04:52:31 +00:00
</style>
```