textarea输入的空格以及换行,如果不转换,那么换行跟空格的效果会消失;

显示的代码:

<span v-html="formInline.content"></span>

解决办法:

// 换行转为换行符

this.model.content = this.model.content.replace(/\n/g,'<br/>');
// 空格转为 &nbsp
this.model.content = this.model.content.replace(/ /g,' &nbsp');

效果如下:

 

 

Logo

前往低代码交流专区

更多推荐