地址组件对接
This commit is contained in:
parent
84b7ca8d35
commit
9de3625421
@ -7,15 +7,13 @@ import Taro from "@tarojs/taro";
|
||||
import { GetAddressListApi } from "@/api/addressList";
|
||||
|
||||
|
||||
type DefaultValueParm = {
|
||||
val: {name?: string, id?:string|number}
|
||||
}
|
||||
type DefaultValueParm = {name?: string, id?:string|number}
|
||||
|
||||
type Params = {
|
||||
addressOnSelect?: (val:DefaultValueParm[]) => void,
|
||||
addressOnClose?: () => void,
|
||||
show?: true|false,
|
||||
defaultValue?:any[]
|
||||
defaultValue?:DefaultValueParm[]
|
||||
}
|
||||
|
||||
type AddresParam = {
|
||||
@ -44,7 +42,7 @@ export default memo(({
|
||||
const [list, setList] = useState<AddresParam[]>([])
|
||||
const [selectIndex, setSelectIndex] = useState(0) //0 省, 1 市,2 区
|
||||
const [selectId, setSelectId] = useState(1) //选中的id
|
||||
const [selectArr, setSelectArr] = useState<any[]>([]) //选中的省市区
|
||||
const [selectArr, setSelectArr] = useState<DefaultValueParm[]>([]) //选中的省市区
|
||||
const [cityStatus, setCityStatus] = useState(false) //城市是否存在
|
||||
const [areaStatus, setAreaStatus] = useState(false) //区镇是否存在
|
||||
|
||||
@ -86,7 +84,7 @@ export default memo(({
|
||||
const onSelectIndex = (index) => {
|
||||
setSelectIndex(index)
|
||||
const selectid = selectArr[index]?selectArr[index].id:0
|
||||
setSelectId(selectid)
|
||||
setSelectId(selectid as number)
|
||||
if(index == 0) {
|
||||
getProvince()
|
||||
} else if (index == 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user