<div>
<span><pre>{{ renderContent }}</pre></span>
</div>
computed: {
renderContent() {
return this.content.replace(/(\n)+/g, "$1").replace(/(結束】)/g, "$1"+"\n");
}
}
replace(/(\n)+/g, "$1")去除文本內容中所有的空白行replace(/(結束】)/g, "$1"+"\n"在整個文本中在“結束】”字符串后面換行- 使用
pre標簽顯示內容,不去除文本中的格式