import React, { FC, useState, forwardRef } from "react"; import { Input } from "antd"; import Selector from "./Selector"; import "./index.scss"; export type IDistrict = { code: string; name: string; provinceCode?: string; cityCode?: string; }; type P = { value4Show?: string; value: string; onChange?(value); forwardRef?; }; const AddressSelector: FC

= props => { const [showSelector, setShowSelector] = useState(false); const [value4Show, setValue4Show] = useState(props.value4Show || ""); //用于展示的值 const handleChange = (value: string, item: IDistrict, items: IDistrict[]) => { const addressNames = items.map(i => i.name).join("/"); setValue4Show(addressNames); props.onChange && props.onChange(value); setShowSelector(false); }; return ( <> { // setShowSelector(false); }} onClick={() => { setShowSelector(true); }} /> ); }; export default forwardRef((props, ref) => ( )); declare let window: Window & { provinceCityDistrict: IDistrict[] };