700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > EasyAdmin弹出层关闭后如何自动刷新当前页面

EasyAdmin弹出层关闭后如何自动刷新当前页面

时间:2019-04-14 06:43:30

相关推荐

EasyAdmin弹出层关闭后如何自动刷新当前页面

找到easy-admin.js

搜索$('body').on('click', '[data-open]', function () 下面内容替换这个方法

$('body').on('click', '[data-open]', function () {var clienWidth = $(this).attr('data-width'),clientHeight = $(this).attr('data-height'),dataFull = $(this).attr('data-full'),checkbox = $(this).attr('data-checkbox'),url = $(this).attr('data-open'),external = $(this).attr('data-external') || false,tableId = $(this).attr('data-table');reload = $(this).attr('data-reload');if(checkbox === 'true'){tableId = tableId || init.table_render_id;var checkStatus = table.checkStatus(tableId),data = checkStatus.data;if (data.length <= 0) {admin.msg.error('请勾选需要操作的数据');return false;}var ids = [];$.each(data, function (i, v) {ids.push(v.id);});if (url.indexOf("?") === -1) {url += '?id=' + ids.join(',');} else {url += '&id=' + ids.join(',');}}if (clienWidth === undefined || clientHeight === undefined) {var width = document.body.clientWidth,height = document.body.clientHeight;if (width >= 800 && height >= 600) {clienWidth = '90%';clientHeight = '90%';} else {clienWidth = '100%';clientHeight = '100%';}}if (dataFull === 'true') {clienWidth = '100%';clientHeight = '100%';}admin.open($(this).attr('data-title'),external ? url : admin.url(url),clienWidth,clientHeight,true,false,reload);});

搜索open: function (title, url, width, height, isResize,

下面内容替换这个方法

open: function (title, url, width, height, isResize, shadeClose = false,reload=false) {isResize = isResize === undefined ? true : isResize;var index = layer.open({title: title,type: 2,area: [width, height],content: url,maxmin: true,moveOut: true,shadeClose: shadeClose,success: function (layero, index) {var body = layer.getChildFrame('body', index);if (body.length > 0) {$.each(body, function (i, v) {// todo 优化弹出层背景色修改$(v).before('<style>\n' +'html, body {\n' +' background: #ffffff;\n' +'}\n' +'</style>');});}},end: function () {if (reload){layer.load(1)window.location.reload()}index = null}});if (admin.checkMobile() || width === undefined || height === undefined) {layer.full(index);}if (isResize) {$(window).on("resize", function () {index && layer.full(index);})}}

效果如下:

当弹出层打开后点击关闭或监听到弹出层关闭,当前打开页面自动刷新一遍

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。