zoukankan      html  css  js  c++  java
  • template-web.js

    1.<script src="/static/js/lib/template/template-web.js"></script>
    
    2.<script>
        //按条件排序
        $('.screen-left a').click(function () {
            var sort = $(this).data('sort');
            $(this).addClass('active').siblings('a').removeClass('active');
            $.get("{:url('index/Goods/getGoods')}", {sort: sort}, function (result) {
                if (result.code === 1) {
                    var result = template("goodsTemplate", result);
                    $('.all-goods').html(result);
                    //分页显示1
                    kkpager.selectPage(1);
                }
            }, 'json');
        })
    </script>
    
    3.<script type="text/html" id="goodsTemplate">
        {literal}
        {{if data}}
        {{each data}}
        <li>
            <div class="content-par">
                <a href="#" class="zs-img">
                    <img src="{{$value.thumb_url[0]}}" alt="" class="lazy-load">
                </a>
                <div class="samll-img">
                    <div class="swiper-container gallery-thumbs">
                        <div class="swiper-wrapper">
                            {{each $value.thumb_url}}
                            <div class='swiper-slide {{if $index==0}}swiper-myactive{{/if}}'><img
                                    src='{{$value}}' alt=''></div>
                            {{/each}}
                        </div>
                        <div class="swiper-button-next swiper-button-white"></div>
                        <div class="swiper-button-prev swiper-button-white"></div>
                    </div>
                    <i class="iconfont icon-icon_arrow_left prev"></i>
                    <i class="iconfont icon-icon_arrow_right next"></i>
    
                </div>
                <div class="goods-serach-price"><sup>¥</sup><span>{{$value.marketprice}}</span></div>
                <a href="#" class="goods-serach-name">{{$value.title}}</a>
                <p class="goods-serach-comment"><a href="#">3700+</a>条评论</p>
                <span class="goods-source">{{$value.detail_shopname}}</span>
            </div>
        </li>
        {{/each}}
        {{else/}}
        找不到宝贝
        {{/if}}
    
        {/literal}
    </script>

    注:{literal} {/literal}是tp5标签,使代码不被tp5模板引擎解析

      

  • 相关阅读:
    Opencv3 ——读取图像,显示图像
    QT5生成log日志
    QT5串口读取宇电温控器温度
    QSettings 配置信息写入本地文件
    Qt5应用程序封包
    python 创建虚拟环境
    Ubuntu更换国内源
    一个关于百度编辑器的小问题
    JavaScript等比例缩放图片(转载)
    asp.net io操作,修改文件夹的名称,报错:access to the path is denied
  • 原文地址:https://www.cnblogs.com/wangyuyanhello/p/9339208.html
Copyright © 2011-2022 走看看