rc.4
This commit is contained in:
parent
687d2c1600
commit
092cc9177c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
21
package.json
21
package.json
@ -14,14 +14,15 @@
|
|||||||
"author": "贤心",
|
"author": "贤心",
|
||||||
"homepage": "http://www.layui.com",
|
"homepage": "http://www.layui.com",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.9.0",
|
|
||||||
"gulp-minify-css": "^1.2.4",
|
|
||||||
"gulp-uglify": "^1.5.4",
|
|
||||||
"gulp-concat": "^2.6.0 ",
|
|
||||||
"gulp-rename": "^1.2.2",
|
|
||||||
"gulp-header": "^1.8.8",
|
|
||||||
"del": "^2.2.2",
|
"del": "^2.2.2",
|
||||||
|
"gulp": "^3.9.1",
|
||||||
|
"gulp-concat": "^2.6.0 ",
|
||||||
|
"gulp-header": "^1.8.8",
|
||||||
"gulp-if": "^2.0.1",
|
"gulp-if": "^2.0.1",
|
||||||
|
"gulp-minify-css": "^1.2.4",
|
||||||
|
"gulp-rename": "^1.2.2",
|
||||||
|
"gulp-uglify": "^1.5.4",
|
||||||
|
"gulp-zip": "^4.0.0",
|
||||||
"minimist": "^1.2.0"
|
"minimist": "^1.2.0"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
@ -32,14 +33,14 @@
|
|||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"del": "^2.2.2",
|
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-header": "^1.8.8",
|
"gulp-uglify": "^1.5.4",
|
||||||
"gulp-if": "^2.0.1",
|
|
||||||
"gulp-minify-css": "^1.2.4",
|
"gulp-minify-css": "^1.2.4",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
"gulp-uglify": "^1.5.4",
|
"gulp-header": "^1.8.8",
|
||||||
|
"gulp-if": "^2.0.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
|
"del": "^2.2.2",
|
||||||
"minimist": "^1.2.0"
|
"minimist": "^1.2.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -352,7 +352,6 @@ a cite{font-style: normal; *cursor:pointer;}
|
|||||||
.layui-tree li a,
|
.layui-tree li a,
|
||||||
.layui-tree li .layui-tree-spread{display: inline-block; vertical-align: top; height: 26px; *display: inline; *zoom:1; cursor: pointer;}
|
.layui-tree li .layui-tree-spread{display: inline-block; vertical-align: top; height: 26px; *display: inline; *zoom:1; cursor: pointer;}
|
||||||
.layui-tree li a{font-size: 0;}
|
.layui-tree li a{font-size: 0;}
|
||||||
.layui-tree li.layui-this>a {width: 100%; background: #eee;} /*增加高亮显示当前选择菜单项*/
|
|
||||||
.layui-tree li a i{font-size: 16px;}
|
.layui-tree li a i{font-size: 16px;}
|
||||||
.layui-tree li a cite{padding: 0 6px; font-size: 14px; font-style: normal;}
|
.layui-tree li a cite{padding: 0 6px; font-size: 14px; font-style: normal;}
|
||||||
.layui-tree li i{padding-left: 6px; color: #333; -moz-user-select: none;}
|
.layui-tree li i{padding-left: 6px; color: #333; -moz-user-select: none;}
|
||||||
|
38
src/layui.js
38
src/layui.js
@ -203,7 +203,7 @@ Lay.fn.link = function(href, fn, cssname){
|
|||||||
head.appendChild(link);
|
head.appendChild(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof fn !== 'function') return ;
|
if(typeof fn !== 'function') return that;
|
||||||
|
|
||||||
//轮询css是否加载完毕
|
//轮询css是否加载完毕
|
||||||
(function poll() {
|
(function poll() {
|
||||||
@ -214,11 +214,13 @@ Lay.fn.link = function(href, fn, cssname){
|
|||||||
fn();
|
fn();
|
||||||
}() : setTimeout(poll, 100);
|
}() : setTimeout(poll, 100);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
//css内部加载器
|
//css内部加载器
|
||||||
Lay.fn.addcss = function(firename, fn, cssname){
|
Lay.fn.addcss = function(firename, fn, cssname){
|
||||||
layui.link(config.dir + 'css/' + firename, fn, cssname);
|
return layui.link(config.dir + 'css/' + firename, fn, cssname);
|
||||||
};
|
};
|
||||||
|
|
||||||
//图片预加载
|
//图片预加载
|
||||||
@ -273,22 +275,26 @@ Lay.fn.extend = function(options){
|
|||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
//路由
|
//路由解析
|
||||||
Lay.fn.router = function(hash){
|
Lay.fn.router = function(hash){
|
||||||
var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
|
var that = this, hash = hash || location.hash, data = {
|
||||||
var item, param = {
|
path: []
|
||||||
dir: []
|
,search: {}
|
||||||
|
,hash: (hash.match(/[^#](#.*$)/) || [])[1] || ''
|
||||||
};
|
};
|
||||||
for(var i = 0; i < hashs.length; i++){
|
|
||||||
item = hashs[i].split('=');
|
if(!/^#\//.test(hash)) return data; //禁止非路由规范
|
||||||
/^\w+=/.test(hashs[i]) ? function(){
|
hash = hash.replace(/^#\//, '').replace(/([^#])(#.*$)/, '$1').split('/') || [];
|
||||||
if(item[0] !== 'dir'){
|
|
||||||
param[item[0]] = item[1];
|
//提取Hash结构
|
||||||
}
|
that.each(hash, function(index, item){
|
||||||
}() : param.dir.push(hashs[i]);
|
/^\w+=/.test(item) ? function(){
|
||||||
item = null;
|
item = item.split('=');
|
||||||
}
|
data.search[item[0]] = item[1];
|
||||||
return param;
|
}() : data.path.push(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
//本地存储
|
//本地存储
|
||||||
|
Loading…
Reference in New Issue
Block a user