自定义多文本输入框我总结的有两种:
一、使用textarea
HTML:
<textarea placeholder="请输入备注内容"> </textarea>
css:
textarea {
width: 17.55rem /* 351/20 */;
height: 7.5rem /* 150/20 */;
padding: .75rem /* 15/20 */;
margin-top: .8rem /* 16/20 */;
background: #F5F7FB;
opacity: 1;
border: none;
resize: none;
font-size: .65rem /* 13/20 */;
font-family: PingFangSC-Regular-, PingFangSC-Regular;
font-weight: normal;
color: #1C2023;
line-height: .9rem /* 18/20 */;
border-radius: .2rem /* 4/20 */;
&::-webkit-input-placeholder {
color: #C4C7CA;
}
}
二、使用div 编写(可以自动检测高度)
在vue 2 中 用 ref 获取内容 ,this.$refs.text.innerHTML 获取输入的内容
在vue3 中:
第一种方法
第二种方法