优化租户管理城市名称解析函数,支持字符串和数组两种数据类型
This commit is contained in:
@@ -226,10 +226,13 @@ const resetQuery = (formEl: FormInstance | undefined) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 解析城市名称
|
// 解析城市名称
|
||||||
const getCityName = (cityArr: string[]) => {
|
const getCityName = (cityName: string | string[]) => {
|
||||||
if (!cityArr || cityArr.length === 0) return '';
|
if (!cityName) return '';
|
||||||
// 这里简单模拟,实际可以用 cityOptions 递归查找
|
// 如果是数组则用 / 连接,如果是字符串直接返回
|
||||||
return cityArr.join(' / ');
|
if (Array.isArray(cityName)) {
|
||||||
|
return cityName.join(' / ');
|
||||||
|
}
|
||||||
|
return cityName;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user