ElementUI中<el-input> textarea类型的输入框,显示空格或者换行符
<el-input
style="width: 600px"
type="textarea"
:rows="8"
placeholder="请输入内容"
v-model="form.notes">
</el-input>
<div class="pd-5">
<span style="padding-bottom: 40px;">使用须知:</span>
<span v-html="detail.notes" style="white-space: pre-line"></span>
</div>
white-space: css属性
- normal 默认,空白会被浏览器忽略。
- pre 空白会被浏览器保留,其行为方式类似 HTML 中的 <pre> 标签。
- nowrap 文本不会换行,文本会在在同一行上继续,直到遇到
标签为止。 - pre-wrap 保留空白符序列,但是正常地进行换行。
- pre-line 合并空白符序列,但是保留换行符。
- inherit 规定应该从父元素继承 white-space 属性的值。