From 7c51280f1cf4b796f9215133b2f99b397cf5325c Mon Sep 17 00:00:00 2001 From: ‘chensiAb’ <‘chenchenco03@163.com’> Date: Wed, 26 Mar 2025 15:29:02 +0800 Subject: [PATCH] 下拉组件-无数据统一暂无数据 --- forms/chinaArea/ChinaLocations.js | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/forms/chinaArea/ChinaLocations.js b/forms/chinaArea/ChinaLocations.js index ff1efb2..ee602ce 100644 --- a/forms/chinaArea/ChinaLocations.js +++ b/forms/chinaArea/ChinaLocations.js @@ -27,7 +27,7 @@ success: response => { locationRes = response.data; readyCallbacks.forEach(callback => callback()); - } + }, }); export class ChinaLocations { @@ -213,8 +213,16 @@ if (typeof regions === 'string') { regions = regions.split(','); } - if (!regions || regions.length === 0 || !regions[0]) { + if (!regions || regions.length === 0 || !regions[0] || !regions[1]) { callback(''); + return; + } + // 中文转编码 + if (!/^\d+$/.test(regions[0])) { + this.getRegionCodes(regions, regionsCode => { + this.getRegionsArea(regionsCode, callback); + }); + return; } let area = ''; // 省 @@ -238,6 +246,6 @@ callback(area); }); } -}; +} export const $locations = new ChinaLocations(); \ No newline at end of file -- Gitblit v1.9.1