Skip to content

Commit

Permalink
feat(check-tag): enable props shape
Browse files Browse the repository at this point in the history
  • Loading branch information
betavs committed Sep 20, 2023
1 parent c0b9c85 commit ec18136
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/check-tag/check-tag.less
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
@tag-extra-large-height: var(--td-tag-extra-large-height, 80rpx);

@tag-square-border-radius: var(--td-tag-square-border-radius, 8rpx);
@tag-round-border-radius: var(--td-tag-round-border-radius, 999px);
@tag-mark-border-radius: var(--td-tag-mark-border-radius, @tag-round-border-radius);

.genVariant(@variant) {
@themes: default, primary, success, warning, danger;
Expand Down Expand Up @@ -132,6 +134,20 @@
}
}

&.@{prefix}-tag {
&--square {
border-radius: @tag-square-border-radius;
}

&--round {
border-radius: @tag-round-border-radius;
}

&--mark {
border-radius: 0 @tag-mark-border-radius @tag-mark-border-radius 0;
}
}

&--dark {
.genVariant(dark);
&.@{prefix}-tag--default {
Expand Down
3 changes: 2 additions & 1 deletion src/check-tag/check-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class CheckTag extends SuperComponent {
methods = {
setClass() {
const { classPrefix } = this.data;
const { size, variant, disabled, checked } = this.properties;
const { size, variant, disabled, checked, shape } = this.properties;
const tagClass = [
classPrefix,
`${classPrefix}--checkable`,
Expand All @@ -58,6 +58,7 @@ export default class CheckTag extends SuperComponent {
`${classPrefix}--${checked ? 'primary' : 'default'}`,
`${classPrefix}--${size}`,
`${classPrefix}--${variant}`,
`${classPrefix}--${shape}`,
];
const className = classNames(tagClass);
this.setData({
Expand Down
2 changes: 1 addition & 1 deletion src/check-tag/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const props: TdCheckTagProps = {
icon: {
type: null,
},
/** 已废弃。标签类型,有三种:方形、圆角方形、标记型 */
/** 标签类型,有三种:方形、圆角方形、标记型 */
shape: {
type: String,
value: 'square',
Expand Down
2 changes: 1 addition & 1 deletion src/tag/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ content | String / Number / Array / Slot | - | Typescript:`string \| number \|
disabled | Boolean | false | \- | N
external-classes | Array | - | `['t-class']` | N
icon | String / Object / Slot | - | \- | N
shape | String | square | `deprecated`options:square/round/mark | N
shape | String | square | options:square/round/mark | N
size | String | medium | options:small/medium/large。Typescript:`SizeEnum` | N
variant | String | dark | `0.26.0`。options:dark/light/outline/light-outline | N

Expand Down
2 changes: 1 addition & 1 deletion src/tag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ closable | Boolean | false | 已废弃。标签是否可关闭 | N
content | String / Number / Array / Slot | - | 组件子元素;传入数组时:[选中内容,非选中内容]。TS 类型:`string \| number \| string[]` | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
icon | String / Object / Slot | - | 标签图标 | N
shape | String | square | 已废弃。标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
size | String | medium | 标签尺寸。可选项:small/medium/large。TS 类型:`SizeEnum` | N
variant | String | dark | `0.26.0`。标签风格变体。可选项:dark/light/outline/light-outline | N

Expand Down

0 comments on commit ec18136

Please sign in to comment.