|
@@ -19,41 +19,41 @@ export default {
|
|
|
props: {
|
|
props: {
|
|
|
value: {
|
|
value: {
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
disabled: {
|
|
disabled: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
|
|
|
|
+ default: false,
|
|
|
},
|
|
},
|
|
|
maxNum: {
|
|
maxNum: {
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
|
- default: 50
|
|
|
|
|
|
|
+ default: 50,
|
|
|
},
|
|
},
|
|
|
placeText: {
|
|
placeText: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: '请您在此输入'
|
|
|
|
|
|
|
+ default: '请您在此输入',
|
|
|
},
|
|
},
|
|
|
txtAreaH: {
|
|
txtAreaH: {
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
|
- default: '50'
|
|
|
|
|
|
|
+ default: '50',
|
|
|
},
|
|
},
|
|
|
switchMax: {
|
|
switchMax: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
|
|
|
|
+ default: false,
|
|
|
},
|
|
},
|
|
|
textBgColor: {
|
|
textBgColor: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: '#fff'
|
|
|
|
|
|
|
+ default: '#fff',
|
|
|
},
|
|
},
|
|
|
limitShow: {
|
|
limitShow: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
- default: true
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ default: true,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
errorState: false,
|
|
errorState: false,
|
|
|
- txtNum: 0
|
|
|
|
|
|
|
+ txtNum: 0,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
mounted() {},
|
|
mounted() {},
|
|
@@ -61,11 +61,16 @@ export default {
|
|
|
currentValue: {
|
|
currentValue: {
|
|
|
get() {
|
|
get() {
|
|
|
this.txtNum = this.value.length;
|
|
this.txtNum = this.value.length;
|
|
|
- return this.value;
|
|
|
|
|
|
|
+ if (this.txtNum > this.maxNum) {
|
|
|
|
|
+ this.txtNum = this.maxNum;
|
|
|
|
|
+ return this.value.substr(0, this.maxNum);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return this.value;
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
- set(val) {}
|
|
|
|
|
|
|
+ set(val) {},
|
|
|
},
|
|
},
|
|
|
- txtAreaHeight: function() {
|
|
|
|
|
|
|
+ txtAreaHeight: function () {
|
|
|
let txtAreaH;
|
|
let txtAreaH;
|
|
|
txtAreaH = this.txtAreaH;
|
|
txtAreaH = this.txtAreaH;
|
|
|
|
|
|
|
@@ -77,7 +82,7 @@ export default {
|
|
|
maxlength = this.maxNum;
|
|
maxlength = this.maxNum;
|
|
|
}
|
|
}
|
|
|
return maxlength;
|
|
return maxlength;
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
txtIptLength(event) {
|
|
txtIptLength(event) {
|
|
@@ -92,7 +97,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.$emit('inputFunc', data);
|
|
this.$emit('inputFunc', data);
|
|
|
this.$emit('input', data);
|
|
this.$emit('input', data);
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|