瀏覽代碼

搜索展示问题处理

wangdy 8 年之前
父節點
當前提交
a0f282e260
共有 2 個文件被更改,包括 7 次插入2 次删除
  1. 6 1
      components/main/Search.vue
  2. 1 1
      components/search/ResultTitle.vue

+ 6 - 1
components/main/Search.vue

@@ -26,7 +26,7 @@
       <li v-if="similarKeywords.data.brand && similarKeywords.data.brand.length > 0" class="similar-title">品牌:</li>
       <li v-for="(k, index) in similarKeywords.data.brand" :key="k.nameCn" class="item"
           :class="{'active': index==associate.activeIndex}"
-          @click.stop.prevent="onAssociateClick(k.nameCn)">{{ k.nameCn }}
+          @click.stop.prevent="onAssociateClick(isCnStart() ? k.nameCn : k.nameEn)">{{ isCnStart() ? k.nameCn : k.nameEn }}
       </li>
       <li v-if="similarKeywords.data.kind && similarKeywords.data.kind.length > 0" class="similar-title">类目:</li>
       <li v-for="(k, index) in similarKeywords.data.kind" :key="k.nameCn" class="item"
@@ -164,6 +164,11 @@
         this.click_flag = true
         this.keyword = word
         this.onSearch()
+      },
+      isCnStart () {
+        if (this.keyword && this.keyword.length > 0) {
+          return this.keyword.charCodeAt(0) > 255
+        }
       }
     },
     created () {

+ 1 - 1
components/search/ResultTitle.vue

@@ -20,7 +20,7 @@
       good_list () {
         if (this.page === 1) {
           if (this.good_lists.data.components && this.good_lists.data.components.length > 0) {
-            if (this.keyword === this.good_lists.data.components[0].code) {
+            if (this.keyword.toUpperCase() === this.good_lists.data.components[0].code.toUpperCase()) {
               this.status = 1
             } else {
               this.status = 2