| | |
| | | /** |
| | | * CChinaArea |
| | | * CChinaArea - 表单项,中国地址三级联动 |
| | | * @author Tevin |
| | | */ |
| | | |
| | |
| | | AtIcon, |
| | | }, |
| | | props: { |
| | | // 表单数据资源(表单组件内部机制专用) |
| | | itemRes: Object, |
| | | // 当地址获取经纬度时,设置加载中显示状态 |
| | | loading: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | // 占位提示 |
| | | placeholder: String, |
| | | itemRes: Object, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | // 省 |
| | | if (curVal[0]) { |
| | | const proviceIndex = locationTree.findIndex( |
| | | (provice) => provice.code === curVal[0] |
| | | provice => provice.code === curVal[0] |
| | | ); |
| | | if (proviceIndex >= 0) { |
| | | range[1] = locationTree[proviceIndex].children; |
| | |
| | | current[0] = proviceIndex; |
| | | // 市 |
| | | if (curVal[1]) { |
| | | const cityIndex = range[1].findIndex((city) => city.code === curVal[1]); |
| | | const cityIndex = range[1].findIndex( |
| | | city => city.code === curVal[1] |
| | | ); |
| | | if (cityIndex >= 0) { |
| | | range[2] = range[1].children[cityIndex].children; |
| | | current[1] = cityIndex; |
| | |
| | | // 区 |
| | | if (curVal[2]) { |
| | | const areaIndex = range[2].findIndex( |
| | | (area) => area.code === curVal[2] |
| | | area => area.code === curVal[2] |
| | | ); |
| | | if (areaIndex >= 0) { |
| | | current[2] === areaIndex; |