• 小程序使用smart模板的方法


    总结:如何在小程序当中使用smarty模板

    1.准备

    a)拥有smarty模板的api接口架构
        例如:TP5
    b)小程序的架构
        例如:微信小程序
    

    2.接口的小程序分支

    1.判断是不是小程序
    2.是小程序请求的情况下将原本要传输回去在小程序中进行循环渲染的数据进行传入接口自己的view层
    3.将view模板解析后的html代码返回给小程序
    

    3.TP如何获取自身的view解析后的代码

    通过$this->assign()进行原本的数据传输
    通过$return['data'] = return $this->fetch()将解析后的代码进行返回
    

    4.小程序接收到属于html代码如何使用

    在.wxml结尾的模板文件中进行:
    <rich-text nodes="{{api_result.wx_view}}"></rich-text>
    就可以将html代码进行写入了
    

    5.html标签兼容性

    官方文档写得极为清楚:
    https://developers.weixin.qq.com/miniprogram/dev/component/rich-text.html
    节点              属性
    a   
    abbr    
    b   
    blockquote  
    br  
    code    
    col             span,width
    colgroup        span,width
    dd  
    del 
    div 
    dl  
    dt  
    em  
    fieldset    
    h1  
    h2  
    h3  
    h4  
    h5  
    h6  
    hr  
    i   
    img             alt,src,height,width
    ins 
    label   
    legend  
    li  
    ol              start,type
    p   
    q   
    span    
    strong  
    sub 
    sup 
    table           width
    tbody   
    td              colspan,height,rowspan,width
    tfoot   
    th              colspan,height,rowspan,width
    thead   
    tr  
    ul
  • 相关阅读:
    使用JdbcTemplate访问数据库
    解决为什么每次打开Eclipse新的workspace需要更新nexus-maven-repository-index问题
    java内存设置
    Eclipse如何解决启动慢
    eclipse的包的加减号展开方式
    maven总结5
    maven总结4
    maven总结3
    maven总结2
    maven总结1
  • 原文地址:https://www.cnblogs.com/hoewang/p/10257194.html
Copyright © 2020-2023  润新知