You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< script setup >
/**
* name:
* user: sa0ChunLuyu
* date: 2024年9月11日 19:24:50
*/
import {
ref ,
onMounted
} from 'vue'
import {
$api ,
$response
} from '@/api'
import {
useStore
} from '@/store'
const $emit = defineEmits ( [ 'setValue' ] )
const $store = useStore ( )
const address _data = ref ( [ ] )
const getAddressData = async ( ) => {
const response = await $api ( 'AddressData' )
$response ( response , ( ) => {
address _data . value = response . data . data . map ( ( i ) => {
return {
text : i . name ,
value : i . code ,
children : i . children . map ( ( ii ) => {
return {
text : ii . name ,
value : ii . code ,
children : ii . children . map ( ( iii ) => {
return {
text : iii . name ,
value : iii . code
}
} )
}
} )
}
} )
//getUserInfo();
} )
}
const $props = defineProps ( {
info : {
type : Object ,
default : ( ) => {
return {
id : 0
}
}
} ,
index : {
type : String ,
default : ''
}
} ) ;
const mountedAction = ( ) => {
getAddressData ( )
}
const onKeyInput = ( e ) => {
$emit ( 'setValue' , $props . index , e . detail . value )
}
onMounted ( ( ) => {
mountedAction ( )
} )
< / script >
< template >
< view >
< view class = "input_wrapper" >
< uni -data -picker v-if ="address_data.length !== 0" v-model="$props.info['value']" placeholder="请选择地址"
popup-title="请选择城市" :localdata="address_data" :step-searh="true" @change="onKeyInput" >
< / uni -data -picker >
< / view >
< / view >
< / template >
< style scoped >
. input _wrapper {
width : 100 % ;
height : 60 rpx ;
margin - top : 20 rpx ;
}
. input _wrapper input {
height : 60 rpx ;
line - height : 60 rpx ;
padding - left : 20 rpx ;
}
< / style >