Browse Source

fix:输入地址无匹配项不显示

qianxinyu 4 months ago
parent
commit
911411298f

+ 8 - 3
pages/addr/index.vue

@@ -50,7 +50,7 @@
           <view class="form_group">
             <view class="group_title">店铺名称:</view>
             <view class="group_box">
-              <uni-combox v-model="addrRequest.contact_shop" :candidates="searchResults" @input="onSearchInput" @change="onSearchChange" placeholder="请输入营业执照全称"> </uni-combox>
+              <uni-combox ref="combox" v-model="addrRequest.contact_shop" :candidates="searchResults" @input="onSearchInput" @change="onSearchChange" placeholder="请输入营业执照全称"> </uni-combox>
             </view>
           </view>
           <view class="form_group">
@@ -76,7 +76,7 @@
           <view class="form_group">
             <view class="group_title">所在地区:</view>
             <view class="group_box">
-              <picker mode="multiSelector" class="form_ctrl" :value="cityValue" :range="cityArray" @columnchange="cityChange" @change="cityFinish">
+              <picker mode="multiSelector" class="form_ctrl" :value="cityValue" @click="onFocus" :range="cityArray" @columnchange="cityChange" @change="cityFinish">
                 <view class="area_text">
                   <text v-if="addrRequest.contact_province">{{ addrRequest.contact_province }}</text>
                   <text v-if="addrRequest.contact_city">/{{ addrRequest.contact_city }}</text>
@@ -88,7 +88,7 @@
           <view class="form_group">
             <view class="group_title">详细地址:</view>
             <view class="group_box">
-              <input type="text" class="form_ctrl" placeholder="请输入详细地址:街道/小区/门牌号" maxlength="64" required="" v-model="addrRequest.contact_addr" />
+              <input type="text" @focus="onFocus" class="form_ctrl" placeholder="请输入详细地址:街道/小区/门牌号" maxlength="64" required="" v-model="addrRequest.contact_addr" />
             </view>
           </view>
           <view class="form_group">
@@ -302,6 +302,7 @@ export default {
     },
     // 城市修改
     cityChange(e) {
+		this.onFocus()
       // 替换三个选项
       this.cityValue.splice(e.detail.column, 1, e.detail.value);
       // 下一级设置为0
@@ -421,8 +422,12 @@ export default {
       });
     },
     handleRadioChange(key) {
+		this.onFocus()
       this.addrRequest.shop_type = Number(key);
     },
+	onFocus(){
+		this.$refs.combox.close()
+	}
   },
 };
 </script>

+ 8 - 2
uni_modules/uni-combox/components/uni-combox/uni-combox.vue

@@ -5,7 +5,10 @@
     </view>
     <view class="uni-combox__input-box">
       <input class="uni-combox__input" type="text" :placeholder="placeholder" placeholder-class="uni-combox__input-plac" v-model="inputVal" @input="onInput" @focus="onFocus" @blur="onBlur" />
-      <uni-icons v-if="!inputVal || !clearAble" :type="showSelector ? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector"> </uni-icons>
+      
+	  <view style="width: 50rpx;text-align: end;">
+		  <uni-icons v-if="!inputVal || !clearAble" :type="showSelector ? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector"> </uni-icons>
+	  </view>
       <uni-icons v-if="inputVal && clearAble" type="clear" size="24" color="#999" @click="clean"> </uni-icons>
     </view>
     <view class="uni-combox__selector" v-if="showSelector && candidates.length !== 0" ref="dropdownRef">
@@ -36,7 +39,7 @@
  */
 export default {
   name: "uniCombox",
-  emits: ["input", "update:modelValue", "change"],
+  emits: ["input", "update:modelValue", "change",],
   props: {
     clearAble: {
       type: Boolean,
@@ -156,6 +159,9 @@ export default {
       this.inputVal = "";
       this.onInput();
     },
+	close() {
+		this.showSelector = false
+	}
   },
 };
 </script>