Sfoglia il codice sorgente

企业地址高度自适应

yangc 7 anni fa
parent
commit
a4d46d5a6e
2 ha cambiato i file con 42 aggiunte e 17 eliminazioni
  1. 7 7
      components/supplier/merchant.vue
  2. 35 10
      pages/mobile/user/storeinfo.vue

+ 7 - 7
components/supplier/merchant.vue

@@ -8,9 +8,7 @@
         <div class="count">
           <img src="/images/supplier/count.png" alt=""/>
           <div class="count_num">
-            <span v-for="spCount in all">
-          {{spCount}}
-          </span>
+            <span v-for="spCount in all" v-text="spCount"></span>
           </div>
         </div>
       </div>
@@ -223,12 +221,14 @@
       }
       div.count{
         position: relative;
-        .count_num{
+        .count_num {
           position:absolute;
           top:4px;
-          left:6px;
-          span{
-            margin:0 2.3px;
+          left:3px;
+          span {
+            display:inline-block;
+            width:29px;
+            text-align: center;
             font-size: 28px;
             color:#4a2f01;
           }

+ 35 - 10
pages/mobile/user/storeinfo.vue

@@ -43,7 +43,8 @@
                     {{storeInfo.enterprise.address || '暂无信息'}}
                   </div>
                   <div v-else class="text pull-left">
-                    <input v-model="storeInfo.enterprise.address" type="text" maxlength="50"/>
+                    <textarea v-model="storeInfo.enterprise.address" maxlength="50" ref="addTextarea"></textarea>
+                    <!--<input v-model="storeInfo.enterprise.address" type="text" maxlength="50"/>-->
                   </div>
                 </li>
                 <li class="clearfix" :class="{border:  storeState !== 'look'}">
@@ -142,6 +143,11 @@
         handler: function (val) {
           this.setTextareaHeight()
         }
+      },
+      'storeInfo.enterprise.address': {
+        handler: function (val) {
+          this.setAddarea()
+        }
       }
     },
     methods: {
@@ -158,6 +164,7 @@
         this.Islook = true
         this.hidelook = true
         this.setTextareaHeight()
+        this.setAddarea()
       },
       dealWithText2(tp) {
         if (tp === 'open') {
@@ -258,10 +265,34 @@
         this.$nextTick(() => {
           let el = this.$refs.descTextarea
           if (el) {
+            el.style.height = '2rem'
+            el.style.height = (el.scrollHeight * 2.06 - el.clientHeight + 150) / 100 + 'rem'
+          }
+        })
+      },
+      setAddarea () {
+        this.$nextTick(() => {
+          let el = this.$refs.addTextarea
+          if (el) {
 //            console.log(el.scrollHeight - el.clientHeight)
-            el.style.height = (el.scrollHeight * 2 - el.clientHeight + 150) / 100 + 'rem'
+//            console.log(el.clientHeight)
+//            console.log('-----------------')
+            el.style.height = '.6rem'
+            el.style.height = (el.scrollHeight * 2 - el.clientHeight + 25) / 100 + 'rem'
           }
         })
+      },
+      setBS () {
+        if (this.BScroll) {
+          this.BScroll.refresh()
+        } else {
+          this.BScroll = new BScroll(this.$refs.userContent, {
+            click: true
+          })
+        }
+      },
+      cancelBS () {
+        this.BScroll.destroy()
       }
     },
     computed: {
@@ -282,13 +313,7 @@
     },
     mounted() {
       this.$nextTick(() => {
-        if (this.BScroll) {
-          this.BScroll.refresh()
-        } else {
-          this.BScroll = new BScroll(this.$refs.userContent, {
-            click: true
-          })
-        }
+        this.setBS()
       })
     }
   }
@@ -389,7 +414,7 @@
     }
     textarea{
       width: 4.4rem;
-      height: 2.06rem;
+      height: 1.36rem;
       padding: 0.06rem 0 0.06rem 0.12rem;
       overflow-y: visible;
       border: none;