mirror of https://github.com/layui/layer
parent
9639abaeb5
commit
2636978c62
File diff suppressed because one or more lines are too long
23
gulpfile.js
23
gulpfile.js
|
@ -19,13 +19,21 @@ var task = {
|
|||
}))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
|
||||
return gulp.src('./src/layer.js').pipe(uglify())
|
||||
return gulp.src('./src/layer.js').pipe(uglify({
|
||||
output: {
|
||||
ascii_only: true //escape Unicode characters in strings and regexps
|
||||
}
|
||||
}))
|
||||
.pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg}))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
|
||||
}
|
||||
,mobile: function() {
|
||||
return gulp.src('./src/mobile/layer.js').pipe(uglify())
|
||||
return gulp.src('./src/mobile/layer.js').pipe(uglify({
|
||||
output: {
|
||||
ascii_only: true //escape Unicode characters in strings and regexps
|
||||
}
|
||||
}))
|
||||
.pipe(header('/*! <%= pkg.realname %> mobile-v<%= pkg.mobile %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg}))
|
||||
.pipe(gulp.dest('./dist/mobile'));
|
||||
}
|
||||
|
@ -43,21 +51,24 @@ gulp.task('layer', task.minjs); //压缩PC版本
|
|||
gulp.task('mobile', task.mincss); //压缩Mobile文件
|
||||
gulp.task('other', task.other); //移动一些配件
|
||||
|
||||
//打包发行版
|
||||
//发行版本目录
|
||||
var releaseDir = './release/zip/layer-v' + pkg.version;
|
||||
var release = releaseDir + '/layer';
|
||||
|
||||
//打包发行版
|
||||
gulp.task('clearZip', function(cb){ //清理
|
||||
return del(['./release/zip/*'], cb);
|
||||
return del([releaseDir], cb);
|
||||
});
|
||||
gulp.task('r', ['clearZip'], function(){
|
||||
gulp.src('./release/doc/**/*')
|
||||
.pipe(gulp.dest(releaseDir))
|
||||
.pipe(gulp.dest(releaseDir));
|
||||
|
||||
return gulp.src([
|
||||
'./dist/**/*'
|
||||
,'!./dist/**/moon'
|
||||
,'!./dist/**/moon/*'
|
||||
])
|
||||
.pipe(gulp.dest(releaseDir + '/layer'))
|
||||
.pipe(gulp.dest(release));
|
||||
});
|
||||
|
||||
//全部
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "layer-src",
|
||||
"realname": "layer",
|
||||
"version": "3.5.0",
|
||||
"version": "3.5.1",
|
||||
"mobile": "2.0.0",
|
||||
"description": "Web 通用弹出层组件",
|
||||
"main": "src/layer.js",
|
||||
|
|
18
src/layer.js
18
src/layer.js
|
@ -93,7 +93,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
|
|||
|
||||
//默认内置方法。
|
||||
var layer = {
|
||||
v: '3.5.0',
|
||||
v: '3.5.1',
|
||||
ie: function(){ //ie版本
|
||||
var agent = navigator.userAgent.toLowerCase();
|
||||
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
|
||||
|
@ -1135,17 +1135,21 @@ layer.photos = function(options, loop, key){
|
|||
var dict = {};
|
||||
options = options || {};
|
||||
if(!options.photos) return;
|
||||
var type = options.photos.constructor === Object;
|
||||
var photos = type ? options.photos : {}, data = photos.data || [];
|
||||
var start = photos.start || 0;
|
||||
dict.imgIndex = (start|0) + 1;
|
||||
|
||||
//若 photos 并非选择器或 jQuery 对象,则为普通 object
|
||||
var isObject = !(typeof options.photos === 'string' || options.photos instanceof $)
|
||||
,photos = isObject ? options.photos : {}
|
||||
,data = photos.data || []
|
||||
,start = photos.start || 0;
|
||||
|
||||
dict.imgIndex = (start|0) + 1;
|
||||
options.img = options.img || 'img';
|
||||
|
||||
var success = options.success;
|
||||
delete options.success;
|
||||
|
||||
if(!type){ //页面直接获取
|
||||
|
||||
//如果 options.photos 不是一个对象
|
||||
if(!isObject){ //页面直接获取
|
||||
var parent = $(options.photos), pushData = function(){
|
||||
data = [];
|
||||
parent.find(options.img).each(function(index){
|
||||
|
|
Loading…
Reference in New Issue