zs 1 年之前
父节点
当前提交
5b0237fc05
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      pages/home/index.vue

+ 9 - 4
pages/home/index.vue

@@ -2,11 +2,11 @@
 	<view class="content">
 		<view class="one">
 			<view class="one_1" v-if="!focus">
-				<input type='text' placeholder='搜索商品' confirm-type='search' @focus="focusHandler"></input>
+				<input type='text' placeholder='搜索商品' @focus="focusHandler"></input>
 			</view>
 			<view class="one_2" v-if="focus">
 				<view class="left">
-					<input type="text" v-model="searchInfo.name" @focus="focusHandler" placeholder="搜索商品">
+					<input type="text" v-model="searchInfo.name" @input="focusHandler" placeholder="搜索商品">
 				</view>
 				<view class="right">
 					<button size="mini" class="button" type="default" @click="cancelHandler">取消</button>
@@ -147,6 +147,7 @@
 				else that.$set(that, `searchInfo`, {})
 				that.clearPage();
 				that.search();
+				that.$set(that, `focus`, false)
 			},
 			async focusHandler(e) {
 				const that = this;
@@ -163,7 +164,10 @@
 			},
 			cancelHandler(e) {
 				const that = this;
+				that.$set(that, `searchInfo`, {})
 				that.$set(that, `focus`, false)
+				that.clearPage();
+				that.search();
 			},
 			async change(e) {
 				uni.navigateTo({
@@ -264,10 +268,11 @@
 					border-bottom: 1px solid var(--f5Color);
 
 					.name {
+						display: inline-block;
+						white-space: nowrap;
+						width: 100%;
 						overflow: hidden;
 						text-overflow: ellipsis;
-						word-break: break-all;
-						display: -webkit-box;
 					}
 				}
 			}