mirror of https://github.com/layui/layui
rc.4
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": "贤心",
|
||||
"homepage": "http://www.layui.com",
|
||||
"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",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-concat": "^2.6.0 ",
|
||||
"gulp-header": "^1.8.8",
|
||||
"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"
|
||||
},
|
||||
"bugs": {
|
||||
|
@ -32,14 +33,14 @@
|
|||
"test": "test"
|
||||
},
|
||||
"dependencies": {
|
||||
"del": "^2.2.2",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-header": "^1.8.8",
|
||||
"gulp-if": "^2.0.1",
|
||||
"gulp-uglify": "^1.5.4",
|
||||
"gulp-minify-css": "^1.2.4",
|
||||
"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",
|
||||
"del": "^2.2.2",
|
||||
"minimist": "^1.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
|
|
@ -352,7 +352,6 @@ a cite{font-style: normal; *cursor:pointer;}
|
|||
.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 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 cite{padding: 0 6px; font-size: 14px; font-style: normal;}
|
||||
.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);
|
||||
}
|
||||
|
||||
if(typeof fn !== 'function') return ;
|
||||
if(typeof fn !== 'function') return that;
|
||||
|
||||
//轮询css是否加载完毕
|
||||
(function poll() {
|
||||
|
@ -214,11 +214,13 @@ Lay.fn.link = function(href, fn, cssname){
|
|||
fn();
|
||||
}() : setTimeout(poll, 100);
|
||||
}());
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
//css内部加载器
|
||||
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;
|
||||
};
|
||||
|
||||
//路由
|
||||
//路由解析
|
||||
Lay.fn.router = function(hash){
|
||||
var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
|
||||
var item, param = {
|
||||
dir: []
|
||||
var that = this, hash = hash || location.hash, data = {
|
||||
path: []
|
||||
,search: {}
|
||||
,hash: (hash.match(/[^#](#.*$)/) || [])[1] || ''
|
||||
};
|
||||
for(var i = 0; i < hashs.length; i++){
|
||||
item = hashs[i].split('=');
|
||||
/^\w+=/.test(hashs[i]) ? function(){
|
||||
if(item[0] !== 'dir'){
|
||||
param[item[0]] = item[1];
|
||||
}
|
||||
}() : param.dir.push(hashs[i]);
|
||||
item = null;
|
||||
}
|
||||
return param;
|
||||
|
||||
if(!/^#\//.test(hash)) return data; //禁止非路由规范
|
||||
hash = hash.replace(/^#\//, '').replace(/([^#])(#.*$)/, '$1').split('/') || [];
|
||||
|
||||
//提取Hash结构
|
||||
that.each(hash, function(index, item){
|
||||
/^\w+=/.test(item) ? function(){
|
||||
item = item.split('=');
|
||||
data.search[item[0]] = item[1];
|
||||
}() : data.path.push(item);
|
||||
});
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
//本地存储
|
||||
|
|
Loading…
Reference in New Issue