Files
mes-ui-d2/docs/zh/components/container.md
liyang 3585e9eb78 no message
Former-commit-id: 21c2eb17a98a8670e50e3c5a01992400b81770e9 [formerly 21c2eb17a98a8670e50e3c5a01992400b81770e9 [formerly 21c2eb17a98a8670e50e3c5a01992400b81770e9 [formerly 21c2eb17a98a8670e50e3c5a01992400b81770e9 [formerly dea08899083aa05e8d6f14614c025b48b97741e6 [formerly 1ce2023c82a4fcd9627e210eb274c69219fd7425]]]]]
Former-commit-id: 940e1f2395a642c9af922dab82dc23bac003f17f
Former-commit-id: 99acadc56e19d94f968c0d8e63a4b25dddde8c3b
Former-commit-id: 21cecee25d507ce21b21c9cbbfc811c8257cfb0d [formerly d218edea00350bf5c15b8c72263474467eea3e56]
Former-commit-id: 7d5e734f081616be0d3b49e7dcb460a9f38c9e11
Former-commit-id: 3b94c9ce56c268eb3b1866883f1c7805673f25b9
Former-commit-id: 642c47e68190eff32090d358c65df31f40854a3c
Former-commit-id: 36eb24536167392823e080fae3d21dde6f9d318c
Former-commit-id: a87d518565feff320f9f4de7b19d3165a5a3c51d
2018-07-02 08:22:28 +08:00

1.9 KiB

页面容器

页面容器组件是每个页面的基础,为了在整个项目中统一效果,它应该是 <template> 组件的直接子组件

参数

参数名 介绍 必选 值类型 可选值 默认值
type 容器类型 String card ghost full card
scroll 滚动优化 Boolean false
responsive 响应式宽度 Boolean false

::: tip responsive 参数设置只在 type 等于 cardghost 时生效 :::

使用方法

一个基础单文件页面组件的示例

<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>

基础页面容器

高度根据内容适应

<d2-container>
  主体内容
</d2-container>

使用 slot

<d2-container>
  <template slot="header">我是插入到 header 中的内容</template>
  主体内容
</d2-container>

自适应填充页面容器

无论内容高度多少,都会自动撑满页面,并有可选的 headerfooter 插槽

示例:

<template>
  <d2-container type="full">
    <template slot="header">
      可选的 header 内容 ...
    </template>
    主体内容 ...
    <template slot="footer">
      可选的 footer 内容 ...
    </template>
  </d2-container>
</template>

v1.1.4 新增

你可以通过设置 :scroll="true" 来启用自定义滚动条,看起来更美观一些

隐形页面容器

不显示任何背景色和边框,通常这个模式只有在极少情况下会使用

<d2-container type="ghost">
  主体内容
</d2-container>

如果你不希望内容紧贴上边,可以在内容外层容器设置 class="d2-mt"