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
},

  转自:https://www.cnblogs.com/fanqiuzhuji/p/12689751.html

上一篇:Shopify开店建站营销推广卖家平台后台中文指南 – Test orders / 测试订单


下一篇:商品期货资金管理策略(教学)