fast admin 全局修改弹窗大小
记录一下全局修改大小,一般第一个方法就可以实现效果
方法一:修改 public\assets\js\fast.js
//打开一个弹出窗口
open: function (url, title, options) {
title = options && options.title ? options.title : (title ? title : "");
url = Fast.api.fixurl(url);
url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > '100%' ? '100%' : '100%', $(window).height() > '100%' ? '100%' : '100%'];
options = $.extend({
type: 2,
title: title,
shadeClose: true,
shade: false,
maxmin: true,
moveOut: true,
area: area,
content: url,
zIndex: Layer.zIndex,
success: function (layero, index) {
var that = this;
//存储callback事件
$(layero).data("callback", that.callback);
//$(layero).removeClass("layui-layer-border");
Layer.setTop(layero);
try {
var frame = Layer.getChildFrame('html', index);
var layerfooter = frame.find(".layer-footer");
Fast.api.layerfooter(layero, index, that);
//绑定事件
if (layerfooter.length > 0) {
// 监听窗口内的元素及属性变化
// Firefox和Chrome早期版本中带有前缀
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
if (MutationObserver) {
// 选择目标节点
var target = layerfooter[0];
// 创建观察者对象
var observer = new MutationObserver(function (mutations) {
Fast.api.layerfooter(layero, index, that);
mutations.forEach(function (mutation) {
});
});
// 配置观察选项:
var config = {attributes: true, childList: true, characterData: true, subtree: true}
// 传入目标节点和观察选项
observer.observe(target, config);
// 随后,你还可以停止观察
// observer.disconnect();
}
}
} catch (e) {
}
if ($(layero).height() > $(window).height()) {
//当弹出窗口大于浏览器可视高度时,重定位
Layer.style(index, {
top: 0,
height: $(window).height()
});
}
}
}, options ? options : {});
if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").length > 0)) {
if (top.$(".tab-pane.active").length > 0) {
options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
} else {
options.area = [$(window).width() + "px", $(window).height() + "px"];
options.offset = ["0px", "0px"];
}
}
return Layer.open(options);
},
方法二:修改 public\assets\js\require-backend.min.js
//打开一个弹出窗口
open: function (url, title, options) {
title = options && options.title ? options.title : (title ? title : "");
url = Fast.api.fixurl(url);
url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > '100%' ? '100%' : '100%', $(window).height() > '100%' ? '100%' : '100%'];
options = $.extend({
type: 2,
title: title,
shadeClose: true,
shade: false,
maxmin: true,
moveOut: true,
area: area,
content: url,
zIndex: Layer.zIndex,
success: function (layero, index) {
var that = this;
//存储callback事件
$(layero).data("callback", that.callback);
//$(layero).removeClass("layui-layer-border");
Layer.setTop(layero);
try {
var frame = Layer.getChildFrame('html', index);
var layerfooter = frame.find(".layer-footer");
Fast.api.layerfooter(layero, index, that);
//绑定事件
if (layerfooter.length > 0) {
// 监听窗口内的元素及属性变化
// Firefox和Chrome早期版本中带有前缀
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
if (MutationObserver) {
// 选择目标节点
var target = layerfooter[0];
// 创建观察者对象
var observer = new MutationObserver(function (mutations) {
Fast.api.layerfooter(layero, index, that);
mutations.forEach(function (mutation) {
});
});
// 配置观察选项:
var config = {attributes: true, childList: true, characterData: true, subtree: true}
// 传入目标节点和观察选项
observer.observe(target, config);
// 随后,你还可以停止观察
// observer.disconnect();
}
}
} catch (e) {
}
if ($(layero).height() > $(window).height()) {
//当弹出窗口大于浏览器可视高度时,重定位
Layer.style(index, {
top: 0,
height: $(window).height()
});
}
}
}, options ? options : {});
if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").length > 0)) {
if (top.$(".tab-pane.active").length > 0) {
options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
} else {
options.area = [$(window).width() + "px", $(window).height() + "px"];
options.offset = ["0px", "0px"];
}
}
return Layer.open(options);
},