Fix tab Right-click menu opens multiple times
parent
f8f0cf8925
commit
1d868f2e98
|
|
@ -458,5 +458,6 @@ layui.define(['table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'fram
|
||||||
res("返回值");
|
res("返回值");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
exports('admin', pearAdmin);
|
exports('admin', pearAdmin);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ layui.define(['jquery', 'element'], function(exports) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var lastIndex;
|
||||||
var tab = createTab(option);
|
var tab = createTab(option);
|
||||||
$("#" + option.elem).html(tab);
|
$("#" + option.elem).html(tab);
|
||||||
$(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-prev").click(function() {
|
$(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-prev").click(function() {
|
||||||
|
|
@ -73,7 +75,7 @@ layui.define(['jquery', 'element'], function(exports) {
|
||||||
var currentId = $(this).attr("lay-id");
|
var currentId = $(this).attr("lay-id");
|
||||||
|
|
||||||
var menu = "<ul><li class='item' id='" + option.elem + "closeThis'>关闭当前</li><li class='item' id='" + option.elem +
|
var menu = "<ul><li class='item' id='" + option.elem + "closeThis'>关闭当前</li><li class='item' id='" + option.elem +
|
||||||
"closeOther'>关闭其他</li><li class='item' id='" + option.elem + "closeAll'>关闭所有</li></ul>"
|
"closeOther'>关闭其他</li><li class='item' id='" + option.elem + "closeAll'>关闭所有</li></ul>";
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
layer.open({
|
layer.open({
|
||||||
|
|
@ -87,8 +89,9 @@ layui.define(['jquery', 'element'], function(exports) {
|
||||||
offset: [top, left],
|
offset: [top, left],
|
||||||
content: menu, //iframe的url,
|
content: menu, //iframe的url,
|
||||||
success: function(layero, index) {
|
success: function(layero, index) {
|
||||||
|
layer.close(lastIndex);
|
||||||
|
lastIndex = index;
|
||||||
menuEvent(option,index);
|
menuEvent(option,index);
|
||||||
console.log("初始化")
|
|
||||||
var timer;
|
var timer;
|
||||||
$(layero).on('mouseout', function() {
|
$(layero).on('mouseout', function() {
|
||||||
timer = setTimeout(function() {
|
timer = setTimeout(function() {
|
||||||
|
|
@ -99,6 +102,12 @@ layui.define(['jquery', 'element'], function(exports) {
|
||||||
$(layero).on('mouseover', function() {
|
$(layero).on('mouseover', function() {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 清除 item 右击
|
||||||
|
$(layero).on('contextmenu',function(){
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue