commit
2801fc3c7c
|
|
@ -43,10 +43,10 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'],
|
||||||
parseData: false,
|
parseData: false,
|
||||||
change:function(){
|
change:function(){
|
||||||
compatible();
|
compatible();
|
||||||
},done(){
|
},
|
||||||
sideMenu.selectItem(param.menu.select);
|
done:function(){}
|
||||||
}
|
});
|
||||||
})
|
sideMenu.selectItem(param.menu.select);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bodyRender = function(param) {
|
this.bodyRender = function(param) {
|
||||||
|
|
|
||||||
|
|
@ -24,29 +24,19 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||||
height: opt.height,
|
height: opt.height,
|
||||||
theme: opt.theme,
|
theme: opt.theme,
|
||||||
data: opt.data ? opt.data : [],
|
data: opt.data ? opt.data : [],
|
||||||
change: opt.change ? opt.change : function() {
|
change: opt.change ? opt.change : function() {},
|
||||||
},
|
|
||||||
done: opt.done ? opt.done : function() {}
|
done: opt.done ? opt.done : function() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option.async) {
|
if (option.async) {
|
||||||
getData(option.url).then(function(data){
|
getData(option.url).then(function(data){
|
||||||
option.data = data;
|
option.data = data;
|
||||||
if (option.parseData != false) {
|
renderMenu(option);
|
||||||
option.parseData(option.data);
|
|
||||||
}
|
|
||||||
if (option.data.length > 0) {
|
|
||||||
if (option.control != false) {
|
|
||||||
createMenuAndControl(option);
|
|
||||||
} else {
|
|
||||||
createMenu(option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
element.init();
|
|
||||||
downShow(option);
|
|
||||||
option.done();
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
renderMenu(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new pearMenu(opt);
|
return new pearMenu(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,6 +140,22 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
||||||
return defer.promise();
|
return defer.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderMenu(option){
|
||||||
|
if (option.parseData != false) {
|
||||||
|
option.parseData(option.data);
|
||||||
|
}
|
||||||
|
if (option.data.length > 0) {
|
||||||
|
if (option.control != false) {
|
||||||
|
createMenuAndControl(option);
|
||||||
|
} else {
|
||||||
|
createMenu(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
element.init();
|
||||||
|
downShow(option);
|
||||||
|
option.done();
|
||||||
|
}
|
||||||
|
|
||||||
function createMenu(option) {
|
function createMenu(option) {
|
||||||
var menuHtml = '<ul lay-filter="' + option.elem +
|
var menuHtml = '<ul lay-filter="' + option.elem +
|
||||||
'" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree">'
|
'" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree">'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue