vue显示微信用户名称中enjoin表情

时间:2019-01-26 13:59:14   收藏:0   阅读:472

后端做了处理转为了Unicode编码存入数据库,但是取出来没做出来,所以前端就做下简单的处理

转换代码:

function decodeUnicode(str) {
    str = str.replace(/\\/g, "%");
    return unescape(str);
};

computed下的代码:

因为要针对数组中的某一元素进行排序,所以先排序,然后再次对这个数组中的用户名称进行转换

 computed: {

draw_usinfo: function() { return sortKey(this.code_result, ‘times‘) }, draw_user: function() { for(var i=0;i<this.draw_usinfo.length;i++){ this.draw_usinfo[i][‘username‘] = decodeUnicode(this.draw_usinfo[i].username); } return this.draw_usinfo; } },

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!