diff --git a/package/component/src/component/line/index.less b/package/component/src/component/line/index.less new file mode 100644 index 00000000..29a4a834 --- /dev/null +++ b/package/component/src/component/line/index.less @@ -0,0 +1,57 @@ +@import (reference) "../../theme/variable.less"; + +.layui-line { + &-horizontal { + position: relative; + clear: both; + width: 100%; + min-width: 100%; + max-width: 100%; + margin: 10px 0; + border-bottom: var(--layui-line-border-width) var(--layui-line-border-style) @global-neutral-color-5; + border-top-style: none; + border-left-style: none; + border-right-style: none; + + &.layui-line-with-text { + margin: 14px 0; + } + } + + &-vertical { + display: inline-block; + min-width: 1px; + max-width: 1px; + height: 1em; + margin: 0 8px; + vertical-align: middle; + border-left: var(--layui-line-border-width) var(--layui-line-border-style) @global-neutral-color-5; + border-top-style: none; + border-bottom-style: none; + border-right-style: none; + } + + &-text { + position: absolute; + top: 50%; + box-sizing: border-box; + padding: 0 10px; + color: currentColor; + line-height: 2; + background-color: #FFF; + transform: translateY(-50%); + + &-center { + left: var(--layui-line-text-offset); + transform: translate(-50%, -50%); + } + + &-left { + left: var(--layui-line-text-offset); + } + + &-right { + right: var(--layui-line-text-offset); + } + } +} \ No newline at end of file diff --git a/package/component/src/component/line/index.vue b/package/component/src/component/line/index.vue index 6b96a0ff..3337d937 100644 --- a/package/component/src/component/line/index.vue +++ b/package/component/src/component/line/index.vue @@ -5,13 +5,68 @@ export default { diff --git a/package/document/src/document/zh-CN/components/line.md b/package/document/src/document/zh-CN/components/line.md index 62830f11..a2f80622 100644 --- a/package/document/src/document/zh-CN/components/line.md +++ b/package/document/src/document/zh-CN/components/line.md @@ -4,7 +4,10 @@ ::: title 基础使用 ::: -::: demo +::: describe 默认为水平分割线 +::: + +::: demo + +::: + + +::: title 竖直分割线 +::: + +::: describe 设置 direction = 'vertical' 即可使用竖直分割线 +::: + +::: demo + + + + + +::: + + + ::: title Line 属性 ::: ::: table -| Name | Description | Accepted Values | +| 属性 | 说明 | 可选值 | | ----- | ----------- | --------------------------------------------- | -| theme | 主题 | `orange` `green` `cyan` `blue` `black` `gray` | +| direction | 分割线的方向 | `horizontal` `vertical`| +| contentPosition | 分割线内容位置 | `center` `left` `right` | +| offset | 分割线内容偏移量,单位 px | eg: `30px` `20%`| +| theme | 主题 | `red` `orange` `green` `cyan` `blue` `black` `gray` 或 string | +| borderWidth | 分割线宽度,单位 px | eg: `2px`| +| borderStyle | 分割线样式 | 参见MDN:border-style | + +::: + +::: title Line 插槽 +::: + +::: table + +| 插槽 | 说明 | +| ------ | ---------- | +| default| 默认插槽,仅支持 direction 为 `horizontal`| :::