Skip to content

Commit

Permalink
fix: 🐛 修复search组件suffix插槽无法使用的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
daofeng-1998 authored and Moonofweisheng committed Apr 4, 2024
1 parent 5fb9542 commit 6a4af41
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
28 changes: 14 additions & 14 deletions docs/component/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ function changeSearchType({ item, index }) {

## Attributes

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

## Events

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

## 外部样式类

Expand Down
3 changes: 2 additions & 1 deletion src/uni_modules/wot-design-uni/components/wd-search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export const searchProps = {
* 是否使用输入框右侧插槽
* 类型: boolean
* 默认值: false
* @deprecated 该属性已废弃,将在下一个minor版本被移除,直接使用插槽即可
*/
userSuffixSlot: makeBooleanProp(false),
useSuffixSlot: makeBooleanProp(false),

/**
* 搜索框占位文本
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
</view>
</view>
<!--the button behind input,care for hideCancel without displaying-->
<block v-if="!hideCancel">
<!--有插槽就不用默认的按钮了-->
<slot v-if="userSuffixSlot" name="suffix"></slot>

<slot v-if="!hideCancel" name="suffix">
<!--默认button-->
<view v-else class="wd-search__cancel" @click="handleCancel">
<view class="wd-search__cancel" @click="handleCancel">
{{ cancelTxt || translate('cancel') }}
</view>
</block>
</slot>
</view>
</template>

Expand Down

0 comments on commit 6a4af41

Please sign in to comment.