add parameterCheck
parent
5e850d2290
commit
81b1d49e84
|
|
@ -6,7 +6,11 @@ layui.define(["element", "layer"], function (exports) {
|
|||
|
||||
var okTab = {
|
||||
add: function (title, path, tabId) {
|
||||
console.log(title, path, tabId);
|
||||
console.log("title:", title, "path:", path, "tabId:", tabId);
|
||||
// 参数校验
|
||||
if (!okTab.parameterCheck(title, path, tabId)) {
|
||||
return false;
|
||||
}
|
||||
// 去重复选项卡
|
||||
var okFrame = $(".ok-frame", window.top.document);
|
||||
for (var i = 0; i < okFrame.length; i++) {
|
||||
|
|
@ -25,7 +29,22 @@ layui.define(["element", "layer"], function (exports) {
|
|||
});
|
||||
// 切换选项卡
|
||||
element.tabChange("ok-tab", tabId);
|
||||
}
|
||||
},
|
||||
parameterCheck: function(title, path, tabId) {
|
||||
if (title == undefined || title == "") {
|
||||
console.error("title未定义")
|
||||
return false;
|
||||
}
|
||||
if (path == undefined || path == "") {
|
||||
console.error("path未定义")
|
||||
return false;
|
||||
}
|
||||
if (tabId == undefined || tabId == "") {
|
||||
console.error("tabId未定义")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
exports("okTab", okTab);
|
||||
|
|
|
|||
Loading…
Reference in New Issue