Former-commit-id: e01489f822c48c2f3b7173e16cb30f08b7379558 [formerly e01489f822c48c2f3b7173e16cb30f08b7379558 [formerly e01489f822c48c2f3b7173e16cb30f08b7379558 [formerly e01489f822c48c2f3b7173e16cb30f08b7379558 [formerly 32c1376e476b5d4edb17809d13574f13823a4549 [formerly 153fadde55a169de719930b038ffec0d1e200ef9]]]]] Former-commit-id: 89f2502e98f2749a24bf8fb7fc0aa149126f04b7 Former-commit-id: e78de3eb9c810e075249551e938c0ee7887b9e41 Former-commit-id: e73a96b6e1d7574e689a1404eb7141c0fb78af57 [formerly b3baaf0bd76aec9c3f7f94a336c4090617ddd840] Former-commit-id: 881e9ffac5a68ccc764522f75a8ea2e6b87f6158 Former-commit-id: 228f0016350b21216c5823eed9aef008def9498c Former-commit-id: 215c5cdf1d4ee0ce2a0edb062cd9eda910d439b8 Former-commit-id: e2341ec18b23031a65320e4f065fe7e9bbe8526b Former-commit-id: 7bba7e84f15f5493180377839b46b6b979469cc7
94 lines
1.8 KiB
Markdown
94 lines
1.8 KiB
Markdown
# 页面容器
|
|
|
|
页面容器组件是每个页面的基础,为了在整个项目中统一效果,它应该是 `<template>` 组件的直接子组件
|
|
|
|
## 参数
|
|
|
|
| 参数名 | 介绍 | 必选 | 值类型 | 可选值 | 默认值 |
|
|
| --- | --- | --- | --- | --- | --- |
|
|
| type | 容器类型 | 非 | String | card ghost full | card |
|
|
| scroll | 滚动优化 | 非 | Boolean | | false |
|
|
| responsive | 响应式宽度 | 非 | Boolean | | false |
|
|
|
|
::: tip
|
|
`responsive` 参数设置只在 `type` 等于 `card` 或 `ghost` 时生效
|
|
:::
|
|
|
|
## 使用方法
|
|
|
|
一个基础单文件页面组件的示例
|
|
|
|
``` vue
|
|
<template>
|
|
<d2-container>
|
|
<template slot="header">
|
|
可选的 header 内容 ...
|
|
</template>
|
|
主体内容 ...
|
|
</d2-container>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'your-component-name'
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
// 需要的话引入
|
|
@import '~@/assets/style/public.scss';
|
|
</style>
|
|
```
|
|
|
|
## 基础页面容器
|
|
|
|
高度根据内容适应
|
|
|
|
``` vue
|
|
<d2-container>
|
|
主体内容
|
|
</d2-container>
|
|
```
|
|
|
|
使用 `slot`
|
|
|
|
``` vue
|
|
<d2-container>
|
|
<template slot="header">我是插入到 header 中的内容</template>
|
|
主体内容
|
|
</d2-container>
|
|
```
|
|
|
|
## 自适应填充页面容器
|
|
|
|
无论内容高度多少,都会自动撑满页面,并有可选的 `header` 和 `footer` 插槽
|
|
|
|
示例:
|
|
|
|
``` vue
|
|
<template>
|
|
<d2-container type="full">
|
|
<template slot="header">
|
|
可选的 header 内容 ...
|
|
</template>
|
|
主体内容 ...
|
|
<template slot="footer">
|
|
可选的 footer 内容 ...
|
|
</template>
|
|
</d2-container>
|
|
</template>
|
|
```
|
|
|
|
`v1.1.4` 新增
|
|
|
|
你可以通过设置 `:scroll="true"` 来启用自定义滚动条,看起来更美观一些
|
|
|
|
## 隐形页面容器
|
|
|
|
不显示任何背景色和边框
|
|
|
|
``` vue
|
|
<d2-container type="ghost">
|
|
主体内容
|
|
</d2-container>
|
|
``` |