layui 弹窗 area属性 内外自适应问题解决方法
function showDialog() {
layer.ready(function () {
var area = ["50%", "60%"];
if ($(document).height() <= 768){ //避免pc分辨率过小1366x680
area = ["80%", "95%"];
}
layer.open({
type: 1,
title: "抉择解决人",
id: "handler",
area: area,
content: $("#dialogTree"),
btn: ["确定", "勾销"],
zIndex: layer.zIndex,
success: function (layero) {
//成功后的执行
},
end: function () {},
btnAlign: "c",
yes: function (index, layero) {
//按钮【确认】的回调
...
layer.close(index);
},
btn2: function (index, layero) {
//按钮【勾销】的回调
},
});
});
};