优化Map
parent
d013270875
commit
8a15d0f86a
|
|
@ -17,8 +17,8 @@ const Map = (props) => {
|
||||||
|
|
||||||
const form = Form.useFormInstance();
|
const form = Form.useFormInstance();
|
||||||
const [mapVisible, setMapVisible] = useState(false);
|
const [mapVisible, setMapVisible] = useState(false);
|
||||||
const [currentLongitude, setCurrentLongitude] = useState(form.getFieldValue(longitudeProps) || "");
|
const [currentLongitude, setCurrentLongitude] = useState("");
|
||||||
const [currentLatitude, setCurrentLatitude] = useState(form.getFieldValue(latitudeProps) || "");
|
const [currentLatitude, setCurrentLatitude] = useState("");
|
||||||
|
|
||||||
const handleMapConfirm = (longitudeValue, latitudeValue, extra) => {
|
const handleMapConfirm = (longitudeValue, latitudeValue, extra) => {
|
||||||
setCurrentLongitude(longitudeValue);
|
setCurrentLongitude(longitudeValue);
|
||||||
|
|
@ -45,7 +45,11 @@ const Map = (props) => {
|
||||||
<Form.Item name={latitudeProps} noStyle rules={[{ required, message: "请选择纬度" }]}>
|
<Form.Item name={latitudeProps} noStyle rules={[{ required, message: "请选择纬度" }]}>
|
||||||
<Input disabled />
|
<Input disabled />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="primary" onClick={() => setMapVisible(true)}>
|
<Button type="primary" onClick={() => {
|
||||||
|
setMapVisible(true);
|
||||||
|
setCurrentLongitude(form.getFieldValue(longitudeProps));
|
||||||
|
setCurrentLatitude(form.getFieldValue(latitudeProps));
|
||||||
|
}}>
|
||||||
地图定位
|
地图定位
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue