-
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ 优化 Divider 分割线功能支持虚线、垂直等功能 (#737)
- Loading branch information
1 parent
abc8488
commit 1b9d7e6
Showing
6 changed files
with
265 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,51 @@ | ||
<!-- | ||
* @Author: weisheng | ||
* @Date: 2023-06-13 11:47:12 | ||
* @LastEditTime: 2023-08-07 20:19:49 | ||
* @LastEditors: weisheng | ||
* @Description: | ||
* @FilePath: \wot-design-uni\src\pages\divider\Index.vue | ||
* 记得注释 | ||
--> | ||
<template> | ||
<page-wraper> | ||
<demo-block title="基本用法" transparent> | ||
<wd-divider>这是分割线</wd-divider> | ||
<wd-divider></wd-divider> | ||
</demo-block> | ||
|
||
<demo-block title="展示文本" transparent> | ||
<wd-divider>展示文本</wd-divider> | ||
</demo-block> | ||
|
||
<demo-block title="自定义渲染内容" transparent> | ||
<wd-divider> | ||
<wd-icon name="arrow-down" size="20" /> | ||
</wd-divider> | ||
</demo-block> | ||
|
||
<demo-block title="内容位置" transparent> | ||
<wd-divider>中间</wd-divider> | ||
<wd-divider content-position="left">左侧</wd-divider> | ||
<wd-divider content-position="right">右侧</wd-divider> | ||
</demo-block> | ||
|
||
<demo-block title="虚线" transparent> | ||
<wd-divider dashed>虚线分割</wd-divider> | ||
</demo-block> | ||
|
||
<demo-block title="自定义颜色" transparent> | ||
<wd-divider color="#4D80F0">自定义颜色</wd-divider> | ||
</demo-block> | ||
|
||
<demo-block title="垂直分割线" transparent> | ||
<view class="content"> | ||
文本 | ||
<wd-divider vertical /> | ||
文本 | ||
<wd-divider vertical dashed /> | ||
文本 | ||
<wd-divider vertical :hairline="false" /> | ||
文本 | ||
<wd-divider vertical color="#1989fa" /> | ||
文本 | ||
</view> | ||
</demo-block> | ||
</page-wraper> | ||
</template> | ||
<script lang="ts" setup></script> | ||
<style lang="scss" scoped></style> | ||
<style lang="scss" scoped> | ||
.content { | ||
padding: 12rpx 15px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 26 additions & 3 deletions
29
src/uni_modules/wot-design-uni/components/wd-divider/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,35 @@ | ||
import type { ExtractPropTypes } from 'vue' | ||
import { baseProps, makeStringProp } from '../common/props' | ||
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props' | ||
|
||
export type DividerPosition = 'center' | 'left' | 'right' | ||
export type DividerDirection = 'horizontal' | 'vertical' | ||
|
||
export const dividerProps = { | ||
...baseProps, | ||
/** | ||
* 自定义颜色,所有颜色的写法 | ||
* 自定义颜色 | ||
*/ | ||
color: makeStringProp(''), | ||
/** | ||
* 内容位置,可选值为 `left` `right` `center` | ||
* 默认值:`center` | ||
*/ | ||
contentPosition: makeStringProp<DividerPosition>('center'), | ||
/** | ||
* 是否显示为虚线 | ||
* 默认值:`false` | ||
*/ | ||
dashed: Boolean, | ||
/** | ||
* 是否为垂直分割线 | ||
* 默认值:`false` | ||
*/ | ||
vertical: makeBooleanProp(false), | ||
/** | ||
* 是否显示为 0.5px 的线 | ||
* 默认值:`true` | ||
*/ | ||
color: makeStringProp('') | ||
hairline: makeBooleanProp(true) | ||
} | ||
|
||
export type DividerProps = ExtractPropTypes<typeof dividerProps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters