分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

template-web.js

发布时间:2023-09-06 02:04责任编辑:赖小花关键词: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]}}" ?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模板引擎解析

  

template-web.js

原文地址:https://www.cnblogs.com/wangyuyanhello/p/9339208.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved