目录

将后端返回的文本解析成html

目录

将后端返回的文本解析成html

解析前

https://i-blog.csdnimg.cn/blog_migrate/2ceccc492cebe3ac6ec592bbe7168124.jpeg

解析后

https://i-blog.csdnimg.cn/blog_migrate/65439136c4cca5fa6ccecd1ec650595b.jpeg

代码

	const reg = new RegExp("\n", "g");
	res.data.notice = decodeURIComponent(res.data.notice).replace(reg,"<br>");
	this.notice = res.data.notice