Commit d2198abb3b01fe13f1aa3e41771593a45b77e6a2

Authored by 王强
1 parent 39416fbd

搜索空格问题处理~

src/components/searchCom/searchCom.vue
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 </div> 9 </div>
10 <div class="line"></div> 10 <div class="line"></div>
11 <div class="input-box"> 11 <div class="input-box">
12 - <input type="search" :placeholder="defaultSearchs.pl" :maxlength="defaultSearchs.maxlength" v-model="defaultSearchs.keyword" class="keyword" @keyup="confirm(defaultSearchs.keyword, $event)" @blur="onBlur" /> 12 + <input type="search" ref="searchInput" :placeholder="defaultSearchs.pl" :maxlength="defaultSearchs.maxlength" v-model="defaultSearchs.keyword" class="keyword" @keyup="confirm(defaultSearchs.keyword, $event)" @blur="onBlur" />
13 </div> 13 </div>
14 </form> 14 </form>
15 </div> 15 </div>
@@ -67,7 +67,13 @@ @@ -67,7 +67,13 @@
67 67
68 // 判断按下的按键是不是回车(确认) 68 // 判断按下的按键是不是回车(确认)
69 if ((keyword && e.keyCode === 13) || (!keyword && e.keyCode === 8)) { 69 if ((keyword && e.keyCode === 13) || (!keyword && e.keyCode === 8)) {
70 - this.$emit("confirm", keyword); 70 +
  71 + // 判断不是空格字符串
  72 + if (keyword.trim()) {
  73 + this.$emit("confirm", keyword);
  74 + } else {
  75 + this.setKeyword('');
  76 + }
71 } 77 }
72 }, 78 },
73 79
@@ -105,6 +111,17 @@ @@ -105,6 +111,17 @@
105 111
106 // 合并参数对象 112 // 合并参数对象
107 Object.assign(this.defaultSearchs, this.searchs); 113 Object.assign(this.defaultSearchs, this.searchs);
  114 +
  115 + // 延时执行
  116 + setTimeout(() => {
  117 +
  118 + this.$nextTick(() => {
  119 +
  120 + if (typeof this.$refs === 'object' && typeof this.$refs.searchInput === 'object') {
  121 + this.$refs.searchInput.focus();
  122 + }
  123 + });
  124 + }, 1000);
108 } 125 }
109 } 126 }
110 </script> 127 </script>
src/pages/search/search.vue
@@ -683,7 +683,7 @@ @@ -683,7 +683,7 @@
683 683
684 // 全部跳转H5达人相关页面,达人个人主页连接 684 // 全部跳转H5达人相关页面,达人个人主页连接
685 if (item.id) { 685 if (item.id) {
686 - window.location.href = (this.mode == "prod") ? "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?id=" + item.id + "&from=redirect" : "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?id=" + item.id + "&from=redirect"; 686 + window.location.href = (this.mode == "prod") ? "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?id=" + item.id + "&from=redirect" + (this.getStore("uid") ? "&uid=" + this.getStore("uid") : "") : "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?id=" + item.id + "&from=redirect" + (this.getStore("uid") ? "&uid=" + this.getStore("uid") : "");
687 } 687 }
688 688
689 // // 判断并调用通用跳转 689 // // 判断并调用通用跳转