一、watch方法:
<input v-model="textareaValue" type="textarea" placeholder="请输入。。。" style="width:100%; height:100px;"><p>还可以输入<span>{{10 - textareaValue.length}}</span>个字符</p> watch: { textareaValue(curVal, oldVal) { if (curVal.length > this.titleMaxLength) { this.textareaValue = String(curVal).slice(0, this.titleMaxLength); } }}(我尝试使用iview-UI的input组件使用这个方法限制字符,存在问题。iview-UI可以使用组件自带的方法。)
转载于:https://www.cnblogs.com/hjbky/p/9258815.html