فهرست منبع

处理手机端表单输入交互问题

Administrator 7 سال پیش
والد
کامیت
e451215f6c
2فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 4 1
      pages/mobile/center/user/cart.vue
  2. 4 1
      pages/mobile/center/user/pay/_orderId.vue

+ 4 - 1
pages/mobile/center/user/cart.vue

@@ -30,7 +30,7 @@
                   <p class="param"><span class="title">数量(PCS):</span>
                     <span class="input-line inline-block">
                     <span class="inline-block" @click="setGoods('sub', goods)" :class="{disab: !goods.goods.canSub}">-</span>
-                    <input type="number" v-model="goods.goods.purchaseNumber" @blur="blurEvent('set', goods)" @focus="focusEvent()">
+                    <input type="number" ref="numberInput" v-model="goods.goods.purchaseNumber" @blur="blurEvent('set', goods)" @focus="focusEvent()">
                     <span class="inline-block" @click="setGoods('add', goods)" :class="{disab: !goods.goods.canAdd}">+</span>
                   </span>
                   </p>
@@ -176,6 +176,9 @@
       blurEvent (type, obj) {
         this.$refs.buyWrap.hidden = false
         this.$store.commit('option/SET_SHOW_MOBILE_FOOTER', true)
+        this.$refs.numberInput.forEach((value) => {
+          value.blur()
+        })
         if (type && obj) {
           this.setGoods(type, obj)
         }

+ 4 - 1
pages/mobile/center/user/pay/_orderId.vue

@@ -38,7 +38,7 @@
                   <div class="ps-goods-item"><span>数量(PCS):</span>
                     <span class="input-line inline-block">
                     <span class="inline-block" @click="setGoods('sub', goods)" :class="{disab: !goods.goods.canSub}">-</span>
-                    <input type="number" v-model="goods.goods.purchaseNumber" @blur="blurEvent('set', goods)" @focus="focusEvent()">
+                    <input type="number" ref="numberInput" v-model="goods.goods.purchaseNumber" @blur="blurEvent('set', goods)" @focus="focusEvent()">
                     <span class="inline-block" @click="setGoods('add', goods)" :class="{disab: !goods.goods.canAdd}">+</span>
                   </span>
                   </div>
@@ -532,6 +532,9 @@
       blurEvent (type, obj) {
         this.$refs.buyWrap.hidden = false
         this.$store.commit('option/SET_SHOW_MOBILE_FOOTER', true)
+        this.$refs.numberInput.forEach((value) => {
+          value.blur()
+        })
         if (type && obj) {
           this.setGoods(type, obj)
         }