.noBorder {
min-height: 150px;
width: 100%;
overflow-y: hidden;
border: none;
resize: none;
pointer-events: none;
}
//textarea 禁止拖拽后高度不能自适应方法
$("textarea").each(function () {
$(this)[0].style.height = $(this)[0].scrollHeight + 'px';
});
css
.layui-input-block{position: relative}
.word{position:absolute;right: 10px;bottom: 10px;color: #aaaaaa;font-size: 12px}
html
<div class="layui-input-block">
<textarea name="decide" id="reviewDecide" maxlength="300" οninput="wordLeg(this)" onpropertychange="if(value.length>300) value =value.substr(0,300)" class="layui-textarea"></textarea>
<div class="word"><span class="text_count">0</span> / <span class="num_count">300</span></div>
</div>
js
window.wordLeg = function (obj) {
var currleg=$(obj).val().length;
var leg = $(obj).attr('maxlength');
if(currleg>leg){
layui.msg('字数请在'+length+'字以内');
}else{
$(obj).next().find('.text_count').text(currleg);
}
};