zoukankan      html  css  js  c++  java
  • 微信小程序 富文本插件 循环渲染方式

    感谢GitHub

    https://github.com/icindy/wxParse/wiki/wxParse%E5%A4%9A%E6%95%B0%E6%8D%AE%E5%BE%AA%E7%8E%AF%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95

    介绍

    介绍如何使用wxParse在回复等多条HTML共同渲染的方法

    方法介绍

    /**
    * WxParse.wxParseTemArray(temArrayName,bindNameReg,total,that)
    * 1.temArrayName: 为你调用时的数组名称
    * 3.bindNameReg为循环的共同体 如绑定为reply1,reply2...则bindNameReg = 'reply'
    * 3.total为reply的个数
    */
    var that = this;
    WxParse.wxParseTemArray("replyTemArray",'reply', replyArr.length, that)
    

    使用方式

    • 循环绑定数据
    var replyHtml0 = `<div style="margin-top:10px;height:50px;">
    		<p class="reply">
    			wxParse回复0:不错,喜欢[03][04]
    		</p>	
    	</div>`;
        var replyHtml1 = `<div style="margin-top:10px;height:50px;">
    		<p class="reply">
    			wxParse回复1:不错,喜欢[03][04]
    		</p>	
    	</div>`;
        var replyHtml2 = `<div style="margin-top:10px;height:50px;">
    		<p class="reply">
    			wxParse回复2:不错,喜欢[05][07]
    		</p>	
    	</div>`;
        var replyHtml3 = `<div style="margin-top:10px;height:50px;">
    		<p class="reply">
    			wxParse回复3:不错,喜欢[06][08]
    		</p>	
    	</div>`;
        var replyHtml4 = `<div style="margin-top:10px; height:50px;">
    		<p class="reply">
    			wxParse回复4:不错,喜欢[09][08]
    		</p>	
    	</div>`;
        var replyHtml5 = `<div style="margin-top:10px;height:50px;">
    		<p class="reply">
    			wxParse回复5:不错,喜欢[07][08]
    		</p>	
    	</div>`;
        var replyArr = [];
        replyArr.push(replyHtml0);
        replyArr.push(replyHtml1);
        replyArr.push(replyHtml2);
        replyArr.push(replyHtml3);
        replyArr.push(replyHtml4);
        replyArr.push(replyHtml5);
    
    
        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)
          }
        }
    
    • 模版使用
       <block wx:for="{{replyTemArray}}" wx:key="">
            回复{{index}}:<template is="wxParse" data="{{wxParseData:item}}"/>
        </block>
    
  • 相关阅读:
    Shared Memory in Windows NT
    Layered Memory Management in Win32
    软件项目管理的75条建议
    Load pdbs when you need it
    Stray pointer 野指针
    About the Rebase and Bind operation in the production of software
    About "Serious Error: No RTTI Data"
    Realizing 4 GB of Address Space[MSDN]
    [bbk4397] 第1集 第一章 AMS介绍
    [bbk3204] 第67集 Chapter 17Monitoring and Detecting Lock Contention(00)
  • 原文地址:https://www.cnblogs.com/zonglonglong/p/9212241.html
Copyright © 2011-2022 走看看