form-create: 字典选择器分离,重新封装 api 选择器

This commit is contained in:
puhui999
2024-05-06 01:24:25 +08:00
parent c77526e8c5
commit 7c158af3cc
10 changed files with 206 additions and 92 deletions

View File

@ -435,3 +435,17 @@ export const areaReplace = (areaName: string) => {
.replace('自治区', '')
.replace('省', '')
}
/**
* 解析 JSON 字符串
*
* @param str
*/
export function jsonParse(str: string) {
try {
return JSON.parse(str)
} catch (e) {
console.log(`str[${str}] 不是一个 JSON 字符串`)
return ''
}
}