Former-commit-id: f9b1dcc686e727bd5dd83b5764e2cd0983a344d4 [formerly f9b1dcc686e727bd5dd83b5764e2cd0983a344d4 [formerly f9b1dcc686e727bd5dd83b5764e2cd0983a344d4 [formerly f9b1dcc686e727bd5dd83b5764e2cd0983a344d4 [formerly d617d3a2cff891cb3530b6487b96e62fa1e9a56b [formerly 5ebd248c8e6fc71258f7497e6861e3b12df8ff4d]]]]] Former-commit-id: 7e192fc2e8275d11d9dde20a25c24e208b92f330 Former-commit-id: 727b71a95c4c2dbcd2409f8d0bb129573ac2ba0d Former-commit-id: 36cc1a9a946196ac72ddc572aa3a189e08435791 [formerly 0051ece832577f08d0b32be7de901bb8b8d9129e] Former-commit-id: c88e08a200959269e97f2f29470cbfa57fe8ae3c Former-commit-id: af64a81ea44b620eb5e88d95ca85fbe65981de22 Former-commit-id: 0f135d9be7792f9a8d38cf361ab834f880c11680 Former-commit-id: 66f0115189d29850594ba700159d2b6984174837 Former-commit-id: 0a7a4e24f9c494ce623f81a96ce0ecd36d076664
89 lines
1.6 KiB
Markdown
89 lines
1.6 KiB
Markdown
# 页面容器
|
|
|
|
页面容器组件是每个页面的基础,为了在整个项目中统一效果,它应该是 `<template>` 组件的直接子组件
|
|
|
|
## 参数
|
|
|
|
| 参数名 | 介绍 | 必选 | 值类型 | 可选值 | 默认值 |
|
|
| --- | --- | --- | --- | --- | --- |
|
|
| type | 容器类型 | 非 | String | card ghost full | card |
|
|
| 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>
|
|
```
|
|
|
|
## 隐形页面容器
|
|
|
|
不显示任何背景色和边框
|
|
|
|
``` vue
|
|
<d2-container type="ghost">
|
|
主体内容
|
|
</d2-container>
|
|
``` |