Browse Source

输入框字数限制

luolei 5 năm trước cách đây
mục cha
commit
15cdd86661
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  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});