Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/search/events #283

Merged
merged 7 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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