From 180ce5c514b59af3d97f41c01991df15e6a67e67 Mon Sep 17 00:00:00 2001 From: PPPSCN <35696959@qq.com> Date: Tue, 10 Apr 2018 07:05:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E7=94=A8slimScroll=E7=BE=8E=E5=8C=96?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/js/fast.js | 18 ++++++++++++++---- public/assets/js/require-table.js | 3 +++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/public/assets/js/fast.js b/public/assets/js/fast.js index 387729d2..18d0ea51 100644 --- a/public/assets/js/fast.js +++ b/public/assets/js/fast.js @@ -1,4 +1,4 @@ -define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) { +define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'slimscroll'], function ($, undefined, Toastr, Layer, Lang, slimScroll) { var Fast = { config: { //toastr默认配置 @@ -105,7 +105,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine } name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), - results = regex.exec(url); + results = regex.exec(url); if (!results) return null; if (!results[2]) @@ -232,8 +232,8 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine }, lang: function () { var args = arguments, - string = args[0], - i = 1; + string = args[0], + i = 1; string = string.toLowerCase(); //string = typeof Lang[string] != 'undefined' ? Lang[string] : string; if (typeof Lang[string] != 'undefined') { @@ -301,6 +301,16 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine }); //公共代码 + $(function ($) { + if (self === top) { + $('#main').slimScroll({height: $(window).height() + 'px'}); + } else { + var ScrollHeight = $('iframe', parent.document).height(); + if (ScrollHeight) { + $('#main').slimScroll({height: ScrollHeight + 'px'}); + } + } + }); //配置Toastr的参数 Toastr.options = Fast.config.toastr; } diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index eb5013e6..c28c2ad3 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -120,6 +120,9 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table }); //当内容渲染完成后 table.on('post-body.bs.table', function (e, settings, json, xhr) { + var ScrollHeight = self == top ? $(window).height() : $('.content-wrapper', parent.document).height(); + table.closest('#main').height(ScrollHeight); + table.closest('.slimScrollDiv').height(ScrollHeight); $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin"); $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true); if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {