Skip to content

Commit

Permalink
fix: 修复pi-search不能清空的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhenfei committed Nov 20, 2020
1 parent 437ee11 commit 5d872b1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
10 changes: 1 addition & 9 deletions components/pi-search/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@focus="handleInputFocus"
/>
<!-- clear action -->
<view v-if="showClear" class="pi-pd-right-18" @tap.stop="handleClearInput">
<view v-if="clearable && val" class="pi-pd-right-18" @tap="handleClearInput">
<view class="pi-icon-roundclosefill" />
</view>
</view>
Expand Down Expand Up @@ -113,11 +113,6 @@ export default {
type: Boolean,
default: search.clearable
},
// 显示清除图标的时机,always 表示输入框不为空时展示,focus 表示输入框聚焦且不为空时展示,(默认'always')
clearTrigger: {
type: String,
default: search.clearTrigger
},
// 是否自动获得焦点(默认false)
focus: {
type: Boolean,
Expand Down Expand Up @@ -239,9 +234,6 @@ export default {
height: this.getHeight,
...this.inputStyle
}
},
showClear() {
return this.clearTrigger === 'always' ? this.val : this.focused && this.val
}
},
watch: {
Expand Down
1 change: 0 additions & 1 deletion config/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default {
shape: 'round', // 搜索框形状 round || square
background: '#f5f5f5', // 背景颜色(默认#f2f2f2)
clearable: true, // 是否启用清除控件(默认true)
clearTrigger: 'always', // 显示清除图标的时机,always 表示输入框不为空时展示,focus 表示输入框聚焦且不为空时展示
focus: false, // 是否自动获得焦点(默认false)
placeholder: '请输入搜索关键词', // 占位提示文字
placeholderStyle: 'color: #cccccc;', // 指定 placeholder 的样式
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sadais-piui",
"version": "1.0.28",
"version": "1.0.29",
"description": "piui组件库",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5d872b1

Please sign in to comment.