Browse Source

Merge remote-tracking branch 'origin/feature/yc-mobile-1020' into feature/wangcz-mobile-1020

wangcz 8 years ago
parent
commit
998a1de97d
2 changed files with 41 additions and 19 deletions
  1. 8 0
      app.html
  2. 33 19
      components/mobile/brand/BrandDetail.vue

+ 8 - 0
app.html

@@ -22,6 +22,14 @@
         appendScript('https://cdn.bootcss.com/js-polyfills/0.1.33/polyfill.min.js')
       }
       if (/(iPhone|iPad|Opera Mini|Android.*Mobile|NetFront|PSP|BlackBerry|Windows Phone)/ig.test(w.navigator.userAgent)) {
+        let meta1 = document.createElement('meta')
+        let meta2 = document.createElement('meta')
+        meta1.name = 'viewport'
+        meta1.content = 'initial-scale=1.0, user-scalable=no, width=device-width'
+        meta2['http-equiv'] = 'Cache-Control'
+        meta2.content = 'no-siteapp'
+        document.getElementsByTagName('head')[0].appendChild(meta1)
+        document.getElementsByTagName('head')[0].appendChild(meta2)
         var docEl = d.documentElement
         var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
         var recalc = function () {

+ 33 - 19
components/mobile/brand/BrandDetail.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="brand-detail">
+  <div class="brand-detail" @click="checkShowFilter()">
     <div class="brand-logo">
       <img :src="brandDetail.logoUrl || '/images/component/default.png'" :alt="brandDetail.nameEn"/>
     </div>
@@ -34,11 +34,13 @@
     <div class="brand-product-list" v-if="activeType=='product'">
       <div class="search-box">
         <div class="kind-selecter">
-          <span @click="showKindList = !showKindList" v-text="selectedKind"></span>
-          <ul v-show="showKindList">
-            <li @click="selectKind({nameCn: '全部分类', id: ''})">全部分类</li>
-            <li v-for="kind in kindList" v-text="kind.nameCn" @click="selectKind(kind)"></li>
-          </ul>
+          <div @mouseenter="isInList = true" @mouseleave="isInList = false">
+            <span @click="showKindList = !showKindList" v-text="selectedKind"></span>
+            <ul v-show="showKindList">
+              <li @click="selectKind({nameCn: '全部分类', id: ''})">全部分类</li>
+              <li v-for="kind in kindList" v-text="kind.nameCn" @click="selectKind(kind)"></li>
+            </ul>
+          </div>
         </div>
         <div class="kind-search">
           <input type="text" v-model="keyword" placeholder="请输入型号">
@@ -70,7 +72,8 @@
           count: 10,
           filter: {}
         },
-        selectedKind: '全部分类'
+        selectedKind: '全部分类',
+        isInList: false
       }
     },
     computed: {
@@ -192,6 +195,11 @@
         } catch (err) {
           this.$store.commit('brandComponent/GET_COMPONENT_FAILURE', err)
         }
+      },
+      checkShowFilter: function () {
+        if (!this.isInList) {
+          this.showKindList = false
+        }
       }
     }
   }
@@ -337,6 +345,9 @@
           &:nth-child(even) {
             background: #f9f9f9;
           }
+          &:active, &:hover {
+            background: #eee;
+          }
           .text-left {
             float: left;
             color: #333;
@@ -360,19 +371,22 @@
           position: relative;
           float: left;
           margin-left: .72rem;
-          span {
-            width: 1.64rem;
-            height: .6rem;
-            line-height: .6rem;
-            border: .01rem solid rgb(195,195,195);
-            border-radius: .05rem;
-            font-size: .28rem;
+          div {
             display: inline-block;
-            background: url('/images/mobile/@2x/productDetail/kind-narrow-down@2x.png')no-repeat;
-            padding-right: .15rem;
-            background-position: 1.35rem .25rem;
-            background-size: .14rem .1rem;
-            overflow: hidden;
+            span {
+              width: 1.64rem;
+              height: .6rem;
+              line-height: .6rem;
+              border: .01rem solid rgb(195,195,195);
+              border-radius: .05rem;
+              font-size: .28rem;
+              display: inline-block;
+              background: url('/images/mobile/@2x/productDetail/kind-narrow-down@2x.png')no-repeat;
+              padding-right: .15rem;
+              background-position: 1.35rem .25rem;
+              background-size: .14rem .1rem;
+              overflow: hidden;
+            }
           }
         }
         .kind-search {