如何在我的 Vue 模板中将特殊字符(数字)转换为符号?
例如我有这个 JSON 数据:
[{"id":"post91","slug":null,"title":"Breakfast & Tea"}]
如何转换 Breakfast &茶
到早餐和茶
?
我的 Vue 模板:
<h3 class="heading">{{ item.title }}</h3>
有什么想法吗?
最佳答案
最好的选择是实际使用 v-html
:
<h3 class="heading" v-html="item.title"></h3>
不需要任何其他库。
关于vue.js - Vue 模板 - 将 HTML 特殊字符(数字)转换为符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46874504/