基于此开发文档:https://developer.mozilla.org/zh-CN/docs/Web/Guide/HTML/Content_Editable
问题:通过contenteditable实现的输入框没有placeholder,所以自己实现了一下
.cd-write{background:#fafafa;padding:8px 12px;position:fixed;left:0;right:0;bottom:0;border-top:solid 1px #dfdede;z-index:10;} .cd-write .btn{background:#fda626;color:white;height:34px;font-size:16px;width:60px;text-align:center;border-radius:5px;line-height:34px;position:fixed;bottom:11px;right:12px;} .cd-write .input{overflow:hidden;padding:8px 6px;border:solid 1px #ebebeb;overflow:auto;background:white;border-radius:5px;min-height:16px;max-height:100px;line-height:140%;outline:none;margin-right:70px;} .cd-write .input:empty:before{content: attr(placeholder);color:#bbb;}
<div class="cd-write"> <div class="btn">发送</div> <div class="input" contentEditable="true" placeholder="评论"></div> </div>