优化选择地区自动绑定model以及地址自动识别示例编写
This commit is contained in:
@@ -251,6 +251,7 @@ const parseRegionWithRegexp = (fragment, hasParseResult) => {
|
||||
}
|
||||
|
||||
if (area.length === 0) {
|
||||
console.log(fragment)
|
||||
for (let i = 1; i < fragment.length; i++) {
|
||||
const str = fragment.substring(0, i + 1)
|
||||
const regexArea = new RegExp(`\{\"code\":\"[0-9]{1,9}\",\"name\":\"${str}[\u4E00-\u9FA5]*?\",\"cityCode\":\"${city[0] ? city[0].code : '[0-9]{1,6}'}\",\"provinceCode\":\"${province[0] ? `${province[0].code}` : '[0-9]{1,6}'}\"\}`, 'g')
|
||||
@@ -277,6 +278,7 @@ const parseRegionWithRegexp = (fragment, hasParseResult) => {
|
||||
if (city.length === 0) {
|
||||
const regexCity = new RegExp(`\{\"code\":\"${cityCode}\",\"name\":\"[\u4E00-\u9FA5]+?\",\"provinceCode\":\"${provinceCode}\"\}`, 'g')
|
||||
const matchCity = cityString.match(regexCity)
|
||||
console.log(matchCity)
|
||||
city.push(JSON.parse(matchCity[0]))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user