|
|
@@ -13,7 +13,8 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, computed, watch } from 'vue'
|
|
|
import { Popup, Cascader, CascaderOption } from 'vant'
|
|
|
-import axios from 'axios'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { getDivisions } from '@/services/api/common'
|
|
|
|
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
|
@@ -89,12 +90,14 @@ const arrayToTree = (list: Model.Region[]) => {
|
|
|
return getChildren('0086')
|
|
|
}
|
|
|
|
|
|
-watch(() => props.label, (val) => {
|
|
|
- inputValue.value = val
|
|
|
+useRequest(getDivisions, {
|
|
|
+ onSuccess: (res) => {
|
|
|
+ options.value = arrayToTree(res.data)
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
-axios('./config/address.json').then((res) => {
|
|
|
- options.value = arrayToTree(res.data)
|
|
|
+watch(() => props.label, (val) => {
|
|
|
+ inputValue.value = val
|
|
|
})
|
|
|
</script>
|
|
|
|