This commit is contained in:
xman 2025-07-08 10:09:11 +08:00
parent f02bdbcb85
commit 4485912f7e

View File

@ -58,12 +58,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
// 为表格2绑定事件 // 为表格2绑定事件
Table.api.bindevent(table2); Table.api.bindevent(table2);
// ✅ 延迟初始化 citypicker 避免 dropdown 位置异常
setTimeout(function () {
var $city = $('#select_city'); var $city = $('#select_city');
if (!$city.data('citypicker')) {
$city.citypicker(); // 延迟初始化,确保元素可见
setTimeout(function () {
if ($city.data('citypicker')) {
$city.citypicker('destroy');
} }
$city.citypicker();
$city.off("cp:updated").on("cp:updated", function () { $city.off("cp:updated").on("cp:updated", function () {
var citypicker = $(this).data("citypicker"); var citypicker = $(this).data("citypicker");
@ -71,16 +73,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
$("#select_area_id").val(code); $("#select_area_id").val(code);
}); });
}, 100); // 手动调整弹层位置,补偿插件可能没有正确计算
var $dropdown = $('.city-picker-dropdown');
// ✅ 清理掉异常 dropdown保险 var offset = $city.offset();
$('.city-picker-dropdown').each(function () { $dropdown.css({
var offset = $(this).offset(); top: offset.top + $city.outerHeight(),
if (offset.top === 0 && offset.left === 0) { left: offset.left
$(this).remove();
}
}); });
}, 200);
} }
}); });