Sfoglia il codice sorgente

输入框字数限制

luolei 5 anni fa
parent
commit
15cdd86661
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      src/common/Input.vue
  2. 1 1
      src/common/OptionInp.vue

+ 1 - 1
src/common/Input.vue

@@ -49,7 +49,7 @@
         this.borColor = true;
         if(this.item.controlType==7){//数字键盘
           if(+e.target.value.length>10){
-            e.target.value=e.target.value.replace(/^\.$/,'').slice(0,10)
+            this.val = e.target.value=e.target.value.replace(/^\.$/,'').slice(0,10)
           }
         }
         // document.activeElement.scrollIntoViewIfNeeded(true);

+ 1 - 1
src/common/OptionInp.vue

@@ -41,7 +41,7 @@ import $ from 'jquery';
       changeVal(e){
         if(this.msg.type=='number'){//数字键盘
           if(+e.target.value.length>10){
-            e.target.value=e.target.value.replace(/^\.$/,'').slice(0,9)
+            this.txt = e.target.value=e.target.value.replace(/^\.$/,'').slice(0,10)
           }
         }
         const newData = Object.assign({},this.part,{value:this.txt});