优化layTable加载动画

This commit is contained in:
邹景立 2022-03-26 20:47:37 +08:00
parent 020c757045
commit 5472a684f0

View File

@ -664,9 +664,9 @@ $(function () {
var option = params || {}, data = option.where || {}, sort = option.initSort || option.sort || {};
option.id = table.id, option.elem = table, option.url = params.url || table.dataset.url || location.href;
option.page = params.page !== false ? (params.page || true) : false, option.limit = params.limit || 20;
option.loading = params.loading === true, option.autoSort = params.autoSort === true, option.cols = params.cols || [[]];
option.loading = params.loading !== false, option.autoSort = params.autoSort === true, option.cols = params.cols || [[]];
// 初始化不显示头部
option.css = (option.css || '') + '.layui-table-box{opacity:0}.layui-table-page{opacity:0}';
option.css = (option.css || '') + '.layui-table-header{opacity:0}.layui-table-body{opacity:0}.layui-table-page{opacity:0}';
// 默认动态设置页数, 动态设置最大高度
if (option.page === true) option.page = {curr: layui.sessionData('pages')[option.id] || 1};
if (option.height === 'full') if ($table.parents('.iframe-pagination').size()) {
@ -677,8 +677,8 @@ $(function () {
}
// 动态计算最大页数
option.done = function () {
$table.data('that', this).next().find('.layui-table-box,.layui-table-page').animate({opacity: 1});
(option.loading = this.loading = true) && layui.sessionData('pages', {key: table.id, value: this.page.curr || 1});
$table.data('that', this).next().find('.layui-table-header,.layui-table-body,.layui-table-page').animate({opacity: 1});
$.form.reInit($table.next()).find('[data-load],[data-queue],[data-action],[data-iframe]').not('[data-table-id]').attr('data-table-id', table.id);
}, option.parseData = function (res) {
if (typeof params.filter === 'function') {