Commit 0a1ee0309ea457cbd91a78e51aec8a26b2b4f45e
1 parent
d2da33ba
因为有onblur事件,推迟一下
Showing
3 changed files
with
11 additions
and
8 deletions
components/lb_sear/lb_sear.js
@@ -11,9 +11,9 @@ Component({ | @@ -11,9 +11,9 @@ Component({ | ||
11 | show_sear_inp(){ | 11 | show_sear_inp(){ |
12 | this.setData({f_sear:1}); | 12 | this.setData({f_sear:1}); |
13 | }, | 13 | }, |
14 | + | ||
14 | blur_sear(){ | 15 | blur_sear(){ |
15 | - if(!this.data.sear_key) | ||
16 | - this.setData({f_sear:0}); | 16 | + if(!this.data.sear_key) this.setData({f_sear:0}); |
17 | }, | 17 | }, |
18 | 18 | ||
19 | search_lb(){ | 19 | search_lb(){ |
@@ -28,8 +28,11 @@ Component({ | @@ -28,8 +28,11 @@ Component({ | ||
28 | 28 | ||
29 | //-- 置空文本输入 -- | 29 | //-- 置空文本输入 -- |
30 | close_txt(e){ | 30 | close_txt(e){ |
31 | - this.setData({sear_key:'',f_sear:1}); | ||
32 | - this.triggerEvent('input_sear',''); | 31 | + setTimeout(()=>{ |
32 | + this.setData({sear_key:'',f_sear:1}); | ||
33 | + this.triggerEvent('input_sear',''); | ||
34 | + },50) | ||
35 | + | ||
33 | }, | 36 | }, |
34 | 37 | ||
35 | //-- 父组件调用 -- | 38 | //-- 父组件调用 -- |
components/lb_sear/lb_sear.wxml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <view bindtap="show_sear_inp" wx:if="{{f_sear==0}}"><text class="iconfont icon-search_fd"></text>搜索礼包</view> | 2 | <view bindtap="show_sear_inp" wx:if="{{f_sear==0}}"><text class="iconfont icon-search_fd"></text>搜索礼包</view> |
3 | <view class="rel inp_box0" wx:else> | 3 | <view class="rel inp_box0" wx:else> |
4 | <input bindinput="input_sear" bindconfirm="search_lb" value="{{sear_key}}" | 4 | <input bindinput="input_sear" bindconfirm="search_lb" value="{{sear_key}}" |
5 | - bindblur="blur_sear" focus="{{f_sear==1}}" style="width: 660rpx;"/> | ||
6 | - <view hidden="{{!sear_key}}" catchtap="close_txt" class="abs close_box fs30"><text class="iconfont icon-guan"></text></view> | 5 | + bindblur="blur_sear" focus="{{f_sear==1}}" style="width: 600rpx;"/> |
6 | + <view hidden="{{!sear_key}}" catchtap="close_txt" class="close_box fs30"><text class="iconfont icon-guan"></text></view> | ||
7 | </view> | 7 | </view> |
8 | </view> | 8 | </view> |
components/lb_sear/lb_sear.wxss
@@ -3,6 +3,6 @@ | @@ -3,6 +3,6 @@ | ||
3 | border-radius:20rpx;bottom: 10rpx; width: 700rpx; left: 25rpx; height: 80rpx; background-color:rgba(255, 255, 255, 0.7); | 3 | border-radius:20rpx;bottom: 10rpx; width: 700rpx; left: 25rpx; height: 80rpx; background-color:rgba(255, 255, 255, 0.7); |
4 | } | 4 | } |
5 | 5 | ||
6 | -.inp_box0{ display: flex; align-items: center; height: 80rpx;} | 6 | +.inp_box0{ display: flex; align-items: center;justify-content: flex-start; height: 80rpx;} |
7 | 7 | ||
8 | -.close_box{top: 0;right: 0; width: 50rpx; height: 80rpx; text-align: right; z-index: 1000;line-height: 80rpx } | ||
9 | \ No newline at end of file | 8 | \ No newline at end of file |
9 | +.close_box{width: 50rpx; height: 80rpx; text-align: right; line-height: 80rpx } | ||
10 | \ No newline at end of file | 10 | \ No newline at end of file |