我如何用权角向输入值倾角?
我可以听到我想要获得信息的话。
但我如何确定我的投入价值?
在我新的PostPage.jsx案中,我使用了这一守则。
const [selectedAddress,setSelectedAddress] = useState();
const [coordinates, setCoordinates] = useState();
<div className="item">
<label htmlFor="address">Address</label>
<GoogleAddressSearch
selectedAddress={(value)=> setSelectedAddress(value)}
setCoordinates={(value)=> setCoordinates(value)}
/>
</div>
GoogleAddressSearch.jsx code
<GooglePlacesAutocomplete apiKey=process.env.GoogleApiKey
selectProps={{
placeholder: Search... ,
isClearable:true,
className: w-full ,
onChange:(place) => {
console.log(place)
selectedAddress(place)
geocodeByAddress(place.label)
.then(result=>getLatLng(result[0]))
.then(({lat,lng}) => {
setCoordinates({lat,lng})
})
}
}}/>
</div>
And I can get the information
Then, I want to put information to input value, how can I do? I need to put city, lat and lng, also it s disable.
I think the city json field is secondary_text
<div className="item">
<label htmlFor="city">City</label>
<input id="city" name="city" type="text" disabled />
</div>
<div className="item">
<label htmlFor="latitude">Latitude</label>
<input id="latitude" name="latitude" type="text" disabled />
</div>
<div className="item">
<label htmlFor="longitude">Longitude</label>
<input id="longitude" name="longitude" type="text" disabled />
</div>