Commit a49bbccb7047e52cf07472ce69e7deafec592aba
1 parent
0a7321e7
我的礼包在切换的时候,要清理搜索的关键字
Showing
3 changed files
with
19 additions
and
5 deletions
components/lb_sear/lb_sear.js
packageA/pages/myGift/myGift.js
| ... | ... | @@ -31,7 +31,16 @@ Page({ |
| 31 | 31 | store_id: app.globalData.setting.stoid, |
| 32 | 32 | user_id: app.globalData.user_id, |
| 33 | 33 | }; |
| 34 | - | |
| 34 | + | |
| 35 | + if(index!=this.data.currentIndex){ | |
| 36 | + this.data.sear_key=''; | |
| 37 | + let lb_sear= this.selectComponent("#lb_sear"); //组件的id | |
| 38 | + if(lb_sear){ | |
| 39 | + lb_sear.clear(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + } | |
| 43 | + | |
| 35 | 44 | this.setData({ |
| 36 | 45 | list: null, |
| 37 | 46 | pageNum: 1, |
| ... | ... | @@ -46,6 +55,8 @@ Page({ |
| 46 | 55 | url = '/api/weshop/libao/libaoFormvip/page'; |
| 47 | 56 | }; |
| 48 | 57 | |
| 58 | + | |
| 59 | + | |
| 49 | 60 | if(this.data.sear_key){ |
| 50 | 61 | data.key_str=this.data.sear_key; |
| 51 | 62 | } | ... | ... |
packageA/pages/myGift/myGift.wxml
| ... | ... | @@ -5,13 +5,13 @@ |
| 5 | 5 | <view class="top_img rel"> |
| 6 | 6 | <image mode="widthFix" src="{{ad_data.ad_code}}" lazy-load="true" |
| 7 | 7 | binderror="bind_bnerr2" data-errorimg="wareCard[{{index}}].lbUrl"></image> |
| 8 | - <lb_sear bindinput_sear="input_sear" bindsearch_lb="search_lb"></lb_sear> | |
| 8 | + <lb_sear id="lb_sear" bindinput_sear="input_sear" bindsearch_lb="search_lb"></lb_sear> | |
| 9 | 9 | </view> |
| 10 | 10 | </block> |
| 11 | 11 | <block wx:else> |
| 12 | 12 | <view class="top_img rel"> |
| 13 | 13 | <image src="{{iurl+'/miniapp/images/giftbag/gift00.jpg?v=2019'}}" lazy-load="true"></image> |
| 14 | - <lb_sear bindinput_sear="input_sear" bindsearch_lb="search_lb"></lb_sear> | |
| 14 | + <lb_sear id="lb_sear" bindinput_sear="input_sear" bindsearch_lb="search_lb"></lb_sear> | |
| 15 | 15 | </view> |
| 16 | 16 | </block> |
| 17 | 17 | ... | ... |