Skip to content

Commit e431294

Browse files
author
xuqingkai
committed
fix: 🐛 修复Step组件description插槽无法使用的问题
1 parent e2e7d37 commit e431294

4 files changed

Lines changed: 17 additions & 41 deletions

File tree

docs/component/steps.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# Steps 标签页
44

5+
:::tip 破坏性更新提醒
6+
`1.2.10`版本`step`组件废弃了`title-slot``icon-slot``description-slot`等三个控制插槽使用的字段,新增支持直接使用`title``icon``description`插槽,同时废弃了`default`插槽。
7+
:::
8+
59

610
## 基本用法
711

@@ -111,20 +115,20 @@ function nextStep() {
111115
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
112116
|-----|------|-----|-------|-------|--------|
113117
| title | 标题,如果没有则为默认文案。当只有标题而没有描述时,标题的字号会小2号 | string | - | - | - |
114-
| title-slot | 使用 title 插槽时需要设置该属性 | boolean | - | false | - |
118+
| <s>title-slot</s> |<s> 使用 title 插槽时需要设置该属性</s>,已废弃,直接使用title插槽即可 | boolean | - | false | - |
115119
| description | 描述 | string | - | - | - |
116-
| description-slot | 使用 description 插槽时需要设置该属性 | boolean | - | false | - |
120+
| <s>description-slot</s> | <s>使用 description 插槽时需要设置该属性</s>,已废弃,直接使用description插槽即可 | boolean | - | false | - |
117121
| icon | 图标 | string | - | - | - |
118-
| icon-slot | 使用 icon 插槽时需要设置该属性 | boolean | - | false | - |
122+
| <s>icon-slot</s> | <s>使用 icon 插槽时需要设置该属性</s>,已废弃,直接使用icon插槽即可 | boolean | - | false | - |
119123
| status | 步骤状态 | string | finished / process / error | - | - |
120124

121125
## Step Slot
122126

123127
| name | 说明 | 最低版本 |
124128
|------|-----|---------|
125-
| icon | 图标 | - |
126-
| title | 标题 | - |
127-
| description | 描述 | - |
129+
| icon | 图标 | 1.2.10 |
130+
| title | 标题 | 1.2.10 |
131+
| description | 描述 | 1.2.10 |
128132

129133
## Steps 外部样式类
130134

src/uni_modules/wot-design-uni/components/wd-button/index.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
}
4141
}
4242

43-
/* #ifdef MP-WEIXIN */
44-
button {
45-
margin: 0;
46-
}
47-
/* #endif */
48-
49-
5043
@include b(button) {
5144
position: relative;
5245
display: inline-flex;

src/uni_modules/wot-design-uni/components/wd-step/types.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,5 @@ export const stepProps = {
2929
* 步骤状态,可选值为 'finished'(已完成)、'process'(进行中)、'error'(出错)。
3030
* 类型: string
3131
*/
32-
status: String as PropType<StepStatus>,
33-
34-
/**
35-
* 当使用icon插槽时,需要设置该属性为true。
36-
* 类型: boolean
37-
* 默认值: false
38-
*/
39-
iconSlot: makeBooleanProp(false),
40-
41-
/**
42-
* 当使用title插槽时,需要设置该属性为true。
43-
* 类型: boolean
44-
* 默认值: false
45-
*/
46-
titleSlot: makeBooleanProp(false),
47-
48-
/**
49-
* 当使用description插槽时,需要设置该属性为true。
50-
* 类型: boolean
51-
* 默认值: false
52-
*/
53-
descriptionSlot: makeBooleanProp(false)
32+
status: String as PropType<StepStatus>
5433
}

src/uni_modules/wot-design-uni/components/wd-step/wd-step.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
:style="styles"
88
>
99
<view :class="`wd-step__header ${dot ? 'is-dot' : ''}`">
10-
<view :class="`wd-step__icon ${dot ? 'is-dot' : !!icon || iconSlot ? 'is-icon' : 'is-text'}`">
10+
<view :class="`wd-step__icon ${dot ? 'is-dot' : !!icon || $slots.icon ? 'is-icon' : 'is-text'}`">
1111
<view v-if="dot" class="wd-step__dot"></view>
12-
<slot v-else-if="iconSlot" name="icon" />
12+
<slot v-else-if="$slots.icon" name="icon" />
1313
<wd-icon v-else-if="icon" custom-class="wd-step__icon-inner" :name="icon" />
1414
<view v-else class="wd-step__icon-outer">
1515
<wd-icon v-if="currentStatus === 'finished'" name="check-bold" />
@@ -20,12 +20,12 @@
2020
<view v-if="index < childrenLength - 1" class="wd-step__line"></view>
2121
</view>
2222
<view class="wd-step__content">
23-
<view :class="`wd-step__title ${descriptionSlot || description ? 'is-description' : ''}`">
24-
<slot v-if="titleSlot" name="title" />
23+
<view :class="`wd-step__title ${$slots.description || description ? 'is-description' : ''}`">
24+
<slot v-if="$slots.title" name="title" />
2525
<text v-else>{{ currentTitle }}</text>
2626
</view>
27-
<view v-if="descriptionSlot || description" class="wd-step__description">
28-
<slot v-if="descriptionSlot" />
27+
<view v-if="$slots.description || description" class="wd-step__description">
28+
<slot v-if="$slots.description" />
2929
<text v-else>{{ description }}</text>
3030
</view>
3131
</view>

0 commit comments

Comments
 (0)