码迷,mamicode.com
首页 > 其他好文 > 详细

Swiper thymeleaf

时间:2017-06-01 13:09:27      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:text   实例   model   ble   tag   thymeleaf   健康   lis   script   



html页面:

<div class="swiper-container swiper_tjzt">
<div class="swiper-wrapper">
	<div class="swiper-slide"  th:each="i : ${#numbers.sequence( 1,((#lists.size(tagListInfos)%8==0)?(#lists.size(tagListInfos)/8):(#lists.size(tagListInfos)/8+1)))}">
		<div class="weui-grids">
			<th:block th:each="tagInfos,iterStat:${tagListInfos}" >
				<th:block th:if="${iterStat.count<=8*i and iterStat.count>=(8*(i-1)+1)}">
					<a class="weui-grid" th:onclick="‘javascript:listBybq(\‘‘+${tagInfos.id}+‘\‘,\‘‘+1+‘\‘);‘">
						<div class="weui-grid__icon">
							<img th:src="@{${tagInfos.bqurl}}"   />
						</div>
						<p class="weui-grid__label" th:text="${tagInfos.bqname}"></p>
					</a>
				</th:block>
			</th:block>
		</div>
	</div>
</div>
<div class="swiper-pagination pagination_tjzt"></div>
</div>

  js部分:

    var mySwiper = new Swiper(‘.swiper_tjzt‘, {
        pagination: ‘.pagination_tjzt‘,
//         paginationClickable: true,
        spaceBetween: 30,
    });

  后端返回json数据实例:

{ "code": "0","msg": "请求成功","data": [{"id":"","bqname": "亲子","bqurl": "图片路径"
},
{"id":"","bqname": "自驾","bqurl": "图片路径"},{"id":"","bqname": "蜜月","bqurl": "图片路径"},{"id":"","bqname": "古镇","bqurl": "图片路径"},{"id":"","bqname": "爸妈游","bqurl": "图片路径"},{"id":"","bqname": "山水游","bqurl": "图片路径"},{"id":"","bqname": "健康养生","bqurl": "图片路径"}]}

  java后台封装:

 

model.addAttribute("tagListInfos",service.获取接口方法返回的json数据());

 

最终实现效果为:

技术分享  

 

thymeleaf 学习文档

 http://www.open-open.com/lib/view/open1451625468230.html

 

Swiper thymeleaf

标签:text   实例   model   ble   tag   thymeleaf   健康   lis   script   

原文地址:http://www.cnblogs.com/1246447850qqcom/p/6928078.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!