Files
mes-ui-d2/docs/zh/components/container.md
liyang b23d572819 no message
Former-commit-id: fa2177d78f85c39d7c09579a1d5acb84b346fe08 [formerly fa2177d78f85c39d7c09579a1d5acb84b346fe08 [formerly fa2177d78f85c39d7c09579a1d5acb84b346fe08 [formerly fa2177d78f85c39d7c09579a1d5acb84b346fe08 [formerly 8390465d98a8307c523383de1cabf895f957f7f1 [formerly 158a4737b05965eefd5ff435f6ef3c4002ffbe83]]]]]
Former-commit-id: a3db87b39113071027ee0544e885f1b231ad890d
Former-commit-id: bba1db492cb6914aaa2f56c13281e5618b3d0e2e
Former-commit-id: 42107d64ae5bfac3723614ed95326bb5f5419e41 [formerly d090d9ea1439d09653dbad558816ac70a1b91cf7]
Former-commit-id: 6f3dbac2d65d17c6ac9a98aa92345bdd78fdeeb8
Former-commit-id: e597a369de513fb9af63bfcda5672d864f485de2
Former-commit-id: f4562f7f9dc40cca8641ffdc8dccd1d36f6abd5f
Former-commit-id: ea6a1b96ebdff9832005176ea31989aa837237a9
Former-commit-id: 302ae6c7a185fa77043f63c6874131c8b6166750
2018-07-01 22:45:41 +08:00

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