submit: 清理tabMenu缓存(okTab.removeTabStorage(callback))
parent
62cc9787e4
commit
9ff8e6611e
|
|
@ -137,7 +137,9 @@ layui.use(["element", "layer", "okUtils", "okTab", "okLayer", "okContextMenu", "
|
|||
* 刷新当前tab页
|
||||
*/
|
||||
$("body").on("click", ".ok-refresh", function () {
|
||||
okTab.refresh(this);
|
||||
okTab.refresh(this, function (okTab) {
|
||||
//刷新之后所处理的事件
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -303,9 +305,11 @@ layui.use(["element", "layer", "okUtils", "okTab", "okLayer", "okContextMenu", "
|
|||
*/
|
||||
$("#logout").click(function () {
|
||||
okLayer.confirm("确定要退出吗?", function (index) {
|
||||
okTab.removeTabStorage(function (res) {
|
||||
window.location = "pages/login.html";
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 锁定账户
|
||||
|
|
|
|||
|
|
@ -31,6 +31,16 @@ let OpenTabMenuFun = function ($, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
/**删除缓存中的tabMenu**/
|
||||
let removeTabMenu = function (okTab, callback) {
|
||||
sessionStorage.removeItem("tabMenu");
|
||||
sessionStorage.removeItem("notice");
|
||||
sessionStorage.removeItem("lay-id");
|
||||
if (typeof callback == "function") {
|
||||
callback(okTab);
|
||||
}
|
||||
};
|
||||
|
||||
/**存储打开的tabMenu**/
|
||||
function saveTabMenuFun($) {
|
||||
let tabTitle = $("<div>" + $("#tabTitle").html() + "</div>");
|
||||
|
|
@ -258,6 +268,11 @@ layui.define(["element", "jquery"], function (exports) {
|
|||
});
|
||||
};
|
||||
|
||||
//删除缓存中的tab
|
||||
okTab.prototype.removeTabStorage = function (callback) {
|
||||
removeTabMenu(this, callback);
|
||||
};
|
||||
|
||||
//添加tab页
|
||||
okTab.prototype.tabAdd = function (_thisa) {
|
||||
var that = this;
|
||||
|
|
@ -366,10 +381,13 @@ layui.define(["element", "jquery"], function (exports) {
|
|||
};
|
||||
|
||||
//刷新当前tab页
|
||||
okTab.prototype.refresh = function (_this) {
|
||||
okTab.prototype.refresh = function (_this, callback) {
|
||||
if (!($(_this).hasClass("refreshThis"))) {
|
||||
$(_this).addClass("refreshThis");
|
||||
$(".ok-tab-content .layui-show").find("iframe")[0].contentWindow.location.reload(true);
|
||||
if(typeof callback == "function"){
|
||||
callback(okTab);
|
||||
}
|
||||
setTimeout(function () {
|
||||
$(_this).removeClass("refreshThis");
|
||||
}, 2000)
|
||||
|
|
|
|||
Loading…
Reference in New Issue