|
发表于 2017-8-24 16:41:22
|
显示全部楼层
如果data中默认就有数据,可以在model的onload中获取中遍历data中的数据给轮播组件设置img
var imgData = this.comp("imgData");
var carousel = this.comp("carousel1");
imgData.each(function(obj) {
var fImgUrl = require.toUrl(obj.row.val("fFImgUrl"));
var fUrl = require.toUrl(obj.row.val("fFUrl"));
if (obj.index == 0) {
localStorage.setItem("index_BannerImg_src", fImgUrl);
localStorage.setItem("index_BannerImg_url", fUrl);
$(carousel.domNode).find("img").eq(obj.index).attr({
"src" : fImgUrl,
"pagename" : fUrl
});
} else {
carousel.add('<img src="' + fImgUrl + '" class="tb-img1" bind-click="openPageClick" pagename="' + fUrl + '"/>');
}
}); |
|