a-multi-shop-master/code/multiShop/WebContent/sky/common/component/imagePanel/js/imagePanel.js
(完整代码) 1KBangular.module('imagePanel',[])
.directive('imagePanel',function(){
return {
restrict:'E',
scope : {
imagePanelId : "@",//该图片面板的ID
currentImgIndex : "@",//当前图片的序号
imagePathList : "=",//图片路径列表
},
templateUrl : $contextPath +"/sky/common/component/imagePanel/template/imagePanel.html",
link : function(scope,element,attrs){
},
controller : function($scope, $timeout, $filter, $document){
//默认的图片
$scope.defaultImage = {
index : -1,
path : $contextPath + "/sky/common/core/img/no_pic.jpeg",
};
//当前显示的图片
$scope.currentImage = $scope.defaultImage;
/**
* 切换图片,向左或右
*/
$scope.triggerImage = function(direction){
//向右切换图片,还是向左切换图片
if(direction && direction=="right"){
if($scope.currentImage.index < $scope.imagePathList.length-1){
$scope.currentImage.index++;
}else{
$scope.currentImage.index = 0;
}
}else{
if($scope.currentImage.index > 0){
$scope.currentImage.index--;
}else{
$scope.currentImage.index = $scope.imagePathList.length-1;
}
}
//当前图片的路径赋值
$scope.currentImage.path = $scope.imagePathList[$scope.currentImage.index];
};
/**
* 初始化图片
*/
$scope.initImage = function(){
if($scope.imagePathList && $scope.imagePathList.length>0){
if(undefined != $scope.currentImgIndex){
$scope.currentImage.index = parseInt($scope.currentImgIndex);
}else{
$scope.currentImage.index = 0;
}
$scope.currentImage.path = $scope.imagePathList[$scope.currentImage.index];
}
};
}
};
});
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
