问题描述
我已经设置了本地投票区域的地图,并希望能够搜索区域号。目的是用户可以在搜索框中键入区域编号,单击正确的区域,地图将缩放到该区域。
相反,当用户搜索区域编号时,Leaflet返回该区域的鼠标悬停标签信息的全部内容,并且当用户单击该结果时,地图将显示错误消息“找不到位置”。
以下代码,带有original shapefile and CSV data file here的Github存储库。
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import InputLabel from "@material-ui/core/InputLabel";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
const useStyles = makeStyles((theme) => ({
formControl: {
margin: theme.spacing(1),minWidth: 120
},selectEmpty: {
marginTop: theme.spacing(2)
}
}));
export default function SimpleSelect() {
const classes = useStyles();
const [age,setAge] = React.useState("");
const handleChange = (event) => {
setAge(event.target.value);
};
return (
<div>
<FormControl
variant="filled"
size="small"
className={classes.formControl}
>
<InputLabel
style={{ color: "#000" }}
id="demo-simple-select-filled-label"
>
Age
</InputLabel>
<Select
style={{ backgroundColor: "rgb(232,241,250)" }}
labelId="demo-simple-select-filled-label"
id="demo-simple-select-filled"
value={age}
onChange={handleChange}
>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</Select>
</FormControl>
</div>
);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)