mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-07 12:38:11 +08:00
fix: 更新 layui 升级导致的 jQuery 兼容问题
This commit is contained in:
parent
51245ddedd
commit
460e06bdf2
@ -24,7 +24,7 @@ define(['md5', 'notify'], function (SparkMD5, Notify, allowMime) {
|
||||
this.option.input = $(this.option.elem.data('input'))
|
||||
} else if (this.option.elem.data('field')) {
|
||||
this.option.input = $('input[name="' + this.option.elem.data('field') + '"]:not([type=file])');
|
||||
this.option.elem.data('input', this.option.input.size() > 0 ? this.option.input.get(0) : null);
|
||||
this.option.elem.data('input', this.option.input.length > 0 ? this.option.input.get(0) : null);
|
||||
}
|
||||
|
||||
/*! 文件选择筛选,使用 MIME 规则过滤文件列表 */
|
||||
|
||||
@ -182,7 +182,7 @@ $(function () {
|
||||
/*! 关闭顶层最新窗口 */
|
||||
this.closeLastModal = function () {
|
||||
while ($.msg.mdx.length > 0 && (this.tdx = $.msg.mdx.pop()) > 0) {
|
||||
if ($('#layui-layer' + this.tdx).size()) return layer.close(this.tdx);
|
||||
if ($('#layui-layer' + this.tdx).length) return layer.close(this.tdx);
|
||||
}
|
||||
};
|
||||
/*! 关闭消息框 */
|
||||
@ -404,15 +404,15 @@ $(function () {
|
||||
this.queryNode = function (uri, node) {
|
||||
// 如果该节点存在直接返回 Node 值
|
||||
if (/^m-/.test(node = node || location.href.replace(/.*spm=([\d\-m]+).*/ig, '$1'))) {
|
||||
if ($('[data-menu-node="' + node + '"]').size()) return node;
|
||||
if ($('[data-menu-node="' + node + '"]').length) return node;
|
||||
}
|
||||
let path = uri.replace(/\.html$/ig, '');
|
||||
// 尝试通过 URI 查询节点值
|
||||
let $menu = $('[data-menu-node][data-open*="' + path + '"]');
|
||||
if ($menu.size()) return $menu.get(0).dataset.menuNode;
|
||||
if ($menu.length) return $menu.get(0).dataset.menuNode;
|
||||
// 尝试通过 URL 查询节点值
|
||||
$menu = $('[data-menu-node][data-open~="#' + path + '"]');
|
||||
return $menu.size() ? $menu.get(0).dataset.menuNode : (/^m-/.test(node || '') ? node : '');
|
||||
return $menu.length ? $menu.get(0).dataset.menuNode : (/^m-/.test(node || '') ? node : '');
|
||||
};
|
||||
/*! 完整 URL 转 URI 地址 */
|
||||
this.parseUri = function (uri, elem, vars, temp, attrs) {
|
||||
@ -665,10 +665,10 @@ $(function () {
|
||||
// 默认动态设置页数, 动态设置最大高度
|
||||
if (option.page === true) option.page = {curr: layui.sessionData('pages')[option.id] || 1};
|
||||
if (option.width === 'full') option.width = $table.parent().width();
|
||||
if (option.height === 'full') if ($table.parents('.iframe-pagination').size()) {
|
||||
if (option.height === 'full') if ($table.parents('.iframe-pagination').length) {
|
||||
$table.parents('.iframe-pagination').addClass('not-footer');
|
||||
option.height = $(window).height() - $table.removeClass('layui-hide').offset().top - 20;
|
||||
} else if ($table.parents('.laytable-pagination').size()) {
|
||||
} else if ($table.parents('.laytable-pagination').length) {
|
||||
option.height = $table.parents('.laytable-pagination').height() - $table.removeClass('layui-hide').position().top - 20;
|
||||
} else {
|
||||
option.height = $(window).height() - $table.removeClass('layui-hide').offset().top - 35;
|
||||
@ -814,7 +814,7 @@ $(function () {
|
||||
let type = form.getAttribute('method') || 'POST', href = form.getAttribute('action') || location.href;
|
||||
let dset = form.dataset, tips = dset.tips || undefined, time = dset.time || undefined, taid = dset.tableId || false;
|
||||
let call = window[dset.callable || '_default_callable'] || (taid ? function (ret) {
|
||||
if (typeof ret === 'object' && ret.code > 0 && $('#' + taid).size() > 0) {
|
||||
if (typeof ret === 'object' && ret.code > 0 && $('#' + taid).length > 0) {
|
||||
return $.msg.success(ret.info, 3, function () {
|
||||
$.msg.closeLastModal();
|
||||
(typeof ret.data === 'string' && ret.data) ? $.form.goto(ret.data) : $.layTable.reload(taid);
|
||||
@ -853,7 +853,7 @@ $(function () {
|
||||
/*! 查找表单元素, 如果没有找到将不会自动写值 */
|
||||
if (!(this.$elem = $(this)).data('input') && this.$elem.data('field')) {
|
||||
let $input = $('input[name="' + this.$elem.data('field') + '"]:not([type=file])');
|
||||
this.$elem.data('input', $input.size() > 0 ? $input.get(0) : null);
|
||||
this.$elem.data('input', $input.length > 0 ? $input.get(0) : null);
|
||||
}
|
||||
// 单图或多图选择器 ( image|images )
|
||||
if (typeof this.dataset.file === 'string' && /^images?$/.test(this.dataset.file)) {
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
function apply(data) {
|
||||
this.$active = $("[data-wechat-type='" + data.value + "']").trigger('click');
|
||||
if (this.$active.size() < 1) $("[data-wechat-type]:first").trigger('click');
|
||||
if (this.$active.length < 1) $("[data-wechat-type]:first").trigger('click');
|
||||
$('[data-type="' + data.value + '"]').show().siblings('[data-type]').hide();
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user