for (let i = 0; i < replyArr.length; i++) {
WxParse.wxParse( 'reply' + i, 'html' , replyArr[i], that);
if (i === replyArr.length - 1) {
WxParse.wxParseTemArray( "replyTemArray" , 'reply' , replyArr.length, that)
}
}
|
function wxParseTemArray(temArrayName,bindNameReg,total,that){
var array = [];
var temData = that.data;
var obj = null ;
for ( var i = 0; i < total; i++){
var simArr = temData[bindNameReg+i].nodes;
array.push(simArr);
}
temArrayName = temArrayName || 'wxParseTemArray' ;
obj = JSON.parse( '{"' + temArrayName + '":""}' );
obj[temArrayName] = array;
that.setData(obj);//渲染页面,耗时
}
|
是用wxparse组件解析的富文本,我是想尝试刷新到一定评论数时,清空这个data中的replies,不过这样会让用户体验不太好,一翻页之前的评论都没了