vue 限制文本框字数(显示当前输入字符数量)
<textarea placeholder="写评论" maxlength="40" @input="descInput" v-model="orders" onchange="this.value=this.value.substring(0, 40)" onkeydown="this.value=this.value.substring(0, 40)" onkeyup="this.value=this.value.substring(0, 40)"> </textarea> <span>{{numbers}} / 40</span> data(){ return{ addshow:false, numbers:0, orders:'' } }, descInput(){ var txtVal = this.orders.length; this.numbers = txtVal },