我正在尝试在由react-leaflet-draw.
这是我的尝试:
_onCreate(e) {
var layer = e.layer
layer.bindPopup(
<Content>
<Label>Flower Name</Label>
<Input type="text" placeholder="Flower Name"/>
<Label>Flower Index</Label>
<Input type="number" placeholder="Flower Index"/>
<Label>Flower Radius</Label>
<Input type="number" placeholder="Flower Radius"/>
<Button color="isSuccess" >Add Flower</Button>
</Content>
)
}
Run Code Online (Sandbox Code Playgroud)
组件由react-bulma 提供。
但我试试这个方法,我得到以下错误:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'。
如果我将内容设为一个简单的字符串,我将获得纯 HTML 字段和一个按钮,但无法访问外部功能或实际的 Bulma 组件。
基本上我希望能够将新形状保存在数据库中。
从简短的在线搜索来看,这似乎是 的限制react-leaflet,但我想先在这里检查一下。
另外,这是为新创建的形状设置弹出窗口的最佳方式吗?我很难将常规leaflet-draw方法翻译为react-leaflet-draw.