Skip to content

Commit

Permalink
rc.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sentsin committed Mar 30, 2017
1 parent 687d2c1 commit 092cc91
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 31 deletions.
4 changes: 2 additions & 2 deletions build/lay/dest/layui.all.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/lay/modules/layedit.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/lay/modules/mobile.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/layui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0 ",
"gulp-rename": "^1.2.2",
"gulp-header": "^1.8.8",
"del": "^2.2.2",
"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": {
Expand All @@ -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": [
Expand Down
1 change: 0 additions & 1 deletion src/css/layui.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
Expand Down
38 changes: 22 additions & 16 deletions src/layui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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);
};

//图片预加载
Expand Down Expand Up @@ -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;
};

//本地存储
Expand Down

0 comments on commit 092cc91

Please sign in to comment.