x
字符会显示为一个相似打印机图标参考hayvane在Weex关于字体图标的bug的回答ios
在template中 text写死 时,weex-template-compiler在编译阶段使用了he进行decode,而在template中Mustache进行数据绑定fontName(fontName:"")时不会进行decode.正则表达式
var he = require('he'); getFontName: function() { return he.decode(this.fontName) }
he
致使打包体积过大经过正则表达式将iconfont的字符取出替换,用String.fromCharCode()方法处理segmentfault
decode(text) { // 正则匹配 图标和文字混排 eg: 我去上学校,每天不迟到 let regExp = /&#x[a-z]\d{3,4};?/; if (regExp.test(text)) { return text.replace(new RegExp(regExp, 'g'), function (iconText) { let replace = iconText.replace(/&#x/, '0x').replace(/;$/, ''); return String.fromCharCode(replace); }); } else { return text; } }
onpullingdown
方法在iOS下拉后会一直调用同问 weex-playground refresh实例在ios中下拉后,会一直不间断的触发onpullingdown方法weex
无