父组件:Login.tsx
子组件:PhoneInput.tsx
父组件点击登录按钮时调用子组件检查手机号码格式的方法
父组件代码
//Login.tsx
import React,{
useState,useRef} from 'react'
import PhoneInput from '../components/phoneInput/PhoneInput'
interface PhoneRef{
checkPhone:(phone:number) => boolean
}
function Login(){
let [phone,setPhone] = useState<number>(