naive-ui/demo/documentation/components/layout/zhCN/showSiderContent.md

67 lines
1.5 KiB
Markdown
Raw Normal View History

2020-01-02 23:21:10 +08:00
# 隐藏侧边栏内容
2020-02-03 20:13:14 +08:00
有时候收起边栏后,你不想看到里面有什么。
2020-01-02 23:21:10 +08:00
```html
<n-switch v-model="collapsed" />
<n-layout style="height: 240px;">
<n-layout-header style="height: 64px;">
2020-02-03 20:13:14 +08:00
酷的页头
2020-01-02 23:21:10 +08:00
</n-layout-header>
<n-layout>
<n-layout-sider
collapse-mode="width"
:show-content="!collapsed"
:collapsed-width="120"
:width="240"
:collapsed="collapsed"
show-toggle-button
@collapse="collapsed = true"
@expand="collapsed = false"
>
2020-02-03 20:13:14 +08:00
<n-h1>酷的边栏</n-h1>
2020-01-02 23:21:10 +08:00
</n-layout-sider>
<n-layout>
<n-layout-content>
2020-02-03 20:13:14 +08:00
<span>内容</span>
2020-01-02 23:21:10 +08:00
</n-layout-content>
<n-layout-footer>
2020-02-03 20:13:14 +08:00
<n-h1>页脚</n-h1>
2020-01-02 23:21:10 +08:00
</n-layout-footer>
</n-layout>
</n-layout>
</n-layout>
<n-layout style="height: 240px; overflow: hidden;">
<n-layout-header position="absolute" style="height: 64px;">
2020-02-03 20:13:14 +08:00
酷的页头
2020-01-02 23:21:10 +08:00
</n-layout-header>
<n-layout position="absolute" style="top: 64px;">
2020-01-02 23:21:10 +08:00
<n-layout-sider
position="absolute"
2020-01-02 23:21:10 +08:00
collapse-mode="transform"
:show-content="!collapsed"
:collapsed-width="120"
:width="240"
:collapsed="collapsed"
show-toggle-button
@collapse="collapsed = true"
@expand="collapsed = false"
>
<n-h1>边栏 边栏 边栏</n-h1>
2020-01-02 23:21:10 +08:00
</n-layout-sider>
<n-layout
position="absolute"
2020-01-02 23:21:10 +08:00
>
2020-02-03 20:13:14 +08:00
<span>内容</span>
2020-01-02 23:21:10 +08:00
</n-layout>
</n-layout>
</n-layout>
```
```js
export default {
data () {
return {
collapsed: false
}
}
}
```