|
@@ -3,7 +3,7 @@
|
|
|
<view class="search-main">
|
|
|
<view class="gosearch-btn">
|
|
|
<text class="iconfont icon-sousuo"></text>
|
|
|
- <input class="input" maxlength="20" type="text" value="" confirm-type="search" @confirm="subMitSearch()" placeholder="请输入关键词" v-model.trim="name"/>
|
|
|
+ <input class="input" maxlength="20" type="text" value="" confirm-type="search" @input="onShowClose" @focus="onFocus" @confirm="subMitSearch()" placeholder="请输入关键词" v-model.trim="name"/>
|
|
|
<text class="iconfont icon-shanchu1" v-if="isShowClose" @click.stop="delInputText()"></text>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -163,6 +163,16 @@
|
|
|
this.$util.msg(error.msg,2000);
|
|
|
})
|
|
|
},
|
|
|
+ onShowClose () {//输入框失去焦点时触发
|
|
|
+ if(this.name != ''){
|
|
|
+ this.isShowClose = true;
|
|
|
+ }else{
|
|
|
+ this.isShowClose = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onFocus () { //输入框获取焦点时触发
|
|
|
+ this.inputEmpty(this.searchInputVal)
|
|
|
+ },
|
|
|
delInputText () { //清除输入框内容
|
|
|
this.name = ''
|
|
|
this.isShowClose = false
|