Ver código fonte

所有数字键盘弹窗改为number类型输入%+-...清空数据

luolei 5 anos atrás
pai
commit
5b27f9141d

+ 1 - 1
build/webpack.dev.conf.js

@@ -34,7 +34,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
     compress: true,
     // host: HOST || config.dev.host,
     // host: '192.168.3.6',
-    host: '192.168.1.104',
+    host: '192.168.1.107',
     port: PORT || config.dev.port,
     open: config.dev.autoOpenBrowser,
     overlay: config.dev.errorOverlay

+ 2 - 2
src/common/Input.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="inp-wrap">
-    <input :type="item.controlType==6?'text':'tel'" 
+    <input :type="item.controlType==6?'text':'number'" 
           :maxlength="item.controlType==6?'':10"
           :class="{'change':borColor}" 
           v-model="val" 
@@ -26,7 +26,7 @@
       changeVal(e){
         this.borColor = true;
         if(this.item.controlType==7){//数字键盘
-          this.val = e.target.value=e.target.value.replace(/[^\d]/g,'')
+          this.val = e.target.value=e.target.value.replace(/^\.|\.$/,'')
         }
         // document.activeElement.scrollIntoViewIfNeeded(true);
         this.borColor = false;

+ 3 - 3
src/common/MultiLineInput.vue

@@ -6,7 +6,7 @@
           <template v-for="(item,idx) in content.iptLis">
             <input v-if="content.iptLis.length>1" 
               class="contentVal" 
-              :type="content.type=='number'?'tel':'text'" 
+              :type="content.type=='number'?'number':'text'" 
               :style="{'width':1/content.iptLis.length*100-3+'%'}" 
               :key="item.placeholder+idx" 
               v-model="item.value"
@@ -17,7 +17,7 @@
               :maxlength="content.type=='number'?10:''"
               @click="handleClick">
             <input v-show="content.iptLis.length==1" class="contentVal" 
-              :type="content.type=='number'?'tel':'text'" 
+              :type="content.type=='number'?'number':'text'" 
               :placeholder="content.placeholder" 
               v-model="item.value"
               @input="changeVal($event,idx,content.type)" 
@@ -74,7 +74,7 @@ export default {
       let tmpTxt = '',arr=this.tmpArr
       document.activeElement.scrollIntoViewIfNeeded(true);
       if(type == 'number'){
-        e.currentTarget.value=e.currentTarget.value.replace(/[^\d]/g,'')
+        e.currentTarget.value = e.currentTarget.value.replace(/^\.|\.$/,'')
       }
       arr[num]=e.currentTarget.value
       tmpTxt=arr.join('/')

+ 3 - 3
src/common/OptionInp.vue

@@ -3,7 +3,7 @@
   <div :class="['inpbox',{'check':item.select},{'exclu':exclu}]">
     <span class="prefix" v-if="msg.prefix">{{msg.prefix}}</span>
     <!-- <div class="inp" @click="preClick"> -->
-      <input :type="msg.type=='number'?'tel':'text'" 
+      <input :type="msg.type=='number'?'number':'text'" 
               :placeholder="msg.placeholder"
               :style="{'width':!msg.prefix&&!msg.suffix?'90%':'33%'}"
               :disabled="exclu"
@@ -27,7 +27,7 @@ import $ from 'jquery';
       return{
         msg:{},
         txt:this.item.value || '',
-        select:0,
+        select:0
       }
     },
     props:['item','exclu'],
@@ -39,7 +39,7 @@ import $ from 'jquery';
     methods:{
       changeVal(e){
         if(this.msg.type=='number'){//数字键盘
-          this.txt = e.target.value=e.target.value.replace(/[^\d]/g,'')
+          this.txt = e.target.value=e.target.value.replace(/^\.|\.$/,'')
         }
         
         const newData = Object.assign({},this.part,{value:this.txt});