vue使用字体图标转码问题

使用iconfont字体之后,出现的是一个方框,而没有出现相应的图标

需要通过String.fromCharCode方法转成指定unicode编码对应的十六进制字符

<div class="info-list">
    <ul>
    <li v-for="(val,key) in essay">
    <i class="iconfont">{{String.fromCharCode(parseInt(val.font,16))}}</i>
    <a href="javascript:void(0);">{{val.content}}</a>
    <span>{{val.txt}}</span>
    </li>                    
    </ul>
</div>
 1     data(){
 2         return{
 3             essay:[
 4                 {
 5                     font:'e7a5;',
 6                     content:'南京江宁楼盘中骏六号街区涉嫌',
 7                     txt:'2018-08-18'
 8                 },
 9                 {
10                     font:'e7a5',
11                     content:'北京江宁楼盘中骏六号街区涉嫌',
12                     txt:'2018-09-18'
13                 },
14                 {
15                     font:'e7a5',
16                     content:'上海江宁楼盘中骏六号街区涉嫌',
17                     txt:'2018-08-8'
18                 },
19                 {
20                     font:'e7a5',
21                     content:'广州江宁楼盘中骏六号街区涉嫌',
22                     txt:'2018-08-28'
23                 }
24             ]
25         }
26     }

猜你喜欢

转载自www.cnblogs.com/theblogs/p/10391486.html