Skip to content

Commit

Permalink
Merge pull request #283 from Tencent/fix/search/events
Browse files Browse the repository at this point in the history
Fix/search/events
  • Loading branch information
PengYYYYY authored Mar 24, 2022
2 parents 7f3c29f + 3d81224 commit e5cca01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/search/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export default class Search extends SuperComponent {
this.triggerEvent('submit', { value });
}

onCancel() {
onActionClick() {
this.triggerEvent('cancel');
this.triggerEvent('action-click');
}
}
19 changes: 3 additions & 16 deletions src/search/search.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
>
<view wx:if="{{label}}" class="{{classPrefix}}__label {{prefix}}-class-label">{{label}}</view>
<slot wx:else name="label" />
<t-icon
wx:if="{{leftIcon}}"
name="{{leftIcon}}"
size="20px"
class="{{prefix}}-icon {{prefix}}-class-left"
/>
<t-icon wx:if="{{leftIcon}}" name="{{leftIcon}}" size="20px" class="{{prefix}}-icon {{prefix}}-class-left" />
<slot wx:else name="left-icon" />
<input
type="text"
Expand All @@ -26,11 +21,7 @@
bind:blur="onBlur"
bind:confirm="onConfirm"
/>
<view
wx:if="{{value !==''}}"
class="{{classPrefix}}__right {{prefix}}-class-right"
bind:tap="handleClear"
>
<view wx:if="{{value !==''}}" class="{{classPrefix}}__right {{prefix}}-class-right" bind:tap="handleClear">
<t-icon
wx:if="{{rightIcon}}"
name="{{rightIcon}}"
Expand All @@ -41,11 +32,7 @@
<slot wx:else name="right-icon" />
</view>
</view>
<view
wx:if="{{action}}"
class="{{classPrefix}}__search-action {{prefix}}-class-cancel"
bindtap="onCancel"
>
<view wx:if="{{action}}" class="{{classPrefix}}__search-action {{prefix}}-class-cancel" bindtap="onActionClick">
{{action}}
</view>
<slot wx:else name="action-text" />
Expand Down

0 comments on commit e5cca01

Please sign in to comment.