Skip to content

Commit 6a4af41

Browse files
daofeng-1998Moonofweisheng
authored andcommitted
fix: 🐛 修复search组件suffix插槽无法使用的问题
1 parent 5fb9542 commit 6a4af41

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

docs/component/search.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,19 +156,19 @@ function changeSearchType({ item, index }) {
156156

157157
## Attributes
158158

159-
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
160-
| ---------------- | ------------------------------------- | --------------- | ------ | ------ | -------- |
161-
| placeholder | 搜索框占位文本 | string | - | 搜索 | - |
162-
| placeholder-left | placeholder 居左边 | boolean | - | false | - |
163-
| cancel-txt | 搜索框右侧文本 | string | - | 取消 | - |
164-
| light | 搜索框亮色(白色) | boolean | - | false | - |
165-
| hide-cancel | 是否隐藏右侧文本 | boolean | - | false | - |
166-
| disabled | 是否禁用搜索框 | boolean | - | false | - |
167-
| maxlength | 原生属性,设置最大长度。-1 表示无限制 | string / number | - | -1 | - |
168-
| v-model | 输入框内容,双向绑定 | string | - | - | - |
169-
| use-suffix-slot | 是否使用输入框右侧插槽 | boolean | - | false | - |
170-
| focus | 是否自动聚焦 | boolean | - | false | 0.1.63 |
171-
| focusWhenClear | 是否在点击清除按钮时聚焦输入框 | boolean | - | false | 0.1.63 |
159+
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
160+
| ------------------- | ----------------------------------------------------------------------------------------- | --------------- | ------ | ------ | -------- |
161+
| placeholder | 搜索框占位文本 | string | - | 搜索 | - |
162+
| placeholder-left | placeholder 居左边 | boolean | - | false | - |
163+
| cancel-txt | 搜索框右侧文本 | string | - | 取消 | - |
164+
| light | 搜索框亮色(白色) | boolean | - | false | - |
165+
| hide-cancel | 是否隐藏右侧文本 | boolean | - | false | - |
166+
| disabled | 是否禁用搜索框 | boolean | - | false | - |
167+
| maxlength | 原生属性,设置最大长度。-1 表示无限制 | string / number | - | -1 | - |
168+
| v-model | 输入框内容,双向绑定 | string | - | - | - |
169+
| ~~use-suffix-slot~~ | ~~是否使用输入框右侧插槽~~**(已废弃,将在下一个 minor 版本被移除,直接使用插槽即可)** | boolean | - | false | - |
170+
| focus | 是否自动聚焦 | boolean | - | false | 0.1.63 |
171+
| focusWhenClear | 是否在点击清除按钮时聚焦输入框 | boolean | - | false | 0.1.63 |
172172

173173
## Events
174174

@@ -186,7 +186,7 @@ function changeSearchType({ item, index }) {
186186
| name | 说明 | 最低版本 |
187187
| ------ | -------------------- | -------- |
188188
| prefix | 输入框左侧自定义内容 | - |
189-
| suffix | 输入框左侧自定义内容 | - |
189+
| suffix | 输入框右侧自定义内容 | - |
190190

191191
## 外部样式类
192192

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ export const searchProps = {
1414
* 是否使用输入框右侧插槽
1515
* 类型: boolean
1616
* 默认值: false
17+
* @deprecated 该属性已废弃,将在下一个minor版本被移除,直接使用插槽即可
1718
*/
18-
userSuffixSlot: makeBooleanProp(false),
19+
useSuffixSlot: makeBooleanProp(false),
1920

2021
/**
2122
* 搜索框占位文本

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@
3232
</view>
3333
</view>
3434
<!--the button behind input,care for hideCancel without displaying-->
35-
<block v-if="!hideCancel">
36-
<!--有插槽就不用默认的按钮了-->
37-
<slot v-if="userSuffixSlot" name="suffix"></slot>
35+
36+
<slot v-if="!hideCancel" name="suffix">
3837
<!--默认button-->
39-
<view v-else class="wd-search__cancel" @click="handleCancel">
38+
<view class="wd-search__cancel" @click="handleCancel">
4039
{{ cancelTxt || translate('cancel') }}
4140
</view>
42-
</block>
41+
</slot>
4342
</view>
4443
</template>
4544

0 commit comments

Comments
 (0)