From 9de3625421c91d12e9f8e1e68931d92a16baea51 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 11 May 2022 17:58:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E7=BB=84=E4=BB=B6=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/address/index.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/address/index.tsx b/src/components/address/index.tsx index 89fcc69..7f96e37 100644 --- a/src/components/address/index.tsx +++ b/src/components/address/index.tsx @@ -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([]) const [selectIndex, setSelectIndex] = useState(0) //0 省, 1 市,2 区 const [selectId, setSelectId] = useState(1) //选中的id - const [selectArr, setSelectArr] = useState([]) //选中的省市区 + const [selectArr, setSelectArr] = useState([]) //选中的省市区 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) {