微信小程序 输入框限制字数
想实现的效果如上图
wxml:
<view class='suggest_title'>请输入你想反馈的问题</view> <view class='suggest_box'> <textarea class='suggest_text' bindinput="bindText" maxlength='200' placeholder='我们有什么地方让您不满意,请输入您的反馈意见' placeholder-class='sug_p'></textarea> <text>{{t_length}}/200</text> </view>
js:
data: { t_length:0, }, bindText: function (e) { var t_text = e.detail.value.length; // console.log(t_text) this.setData({ t_length: t_text }) },