我正在用 R 構(gòu)建 Leaflet 應(yīng)用程序。我想使用這個插件https://github.com/Turbo87/leaflet-sidebar 但是,我不知道從哪里開始。在 R 中實(shí)現(xiàn) Javascript Leaflet 插件的指南無法提供幫助。有沒有人有我可以遵循的任何步驟/指導(dǎo)/代碼來在我的 R Leaflet 中實(shí)現(xiàn)插件?任何幫助將不勝感激。這是我目前所在的位置:sidebarPlugin <- htmlDependency("leaflet-sidebar", "0.2.0", src = c(href = "https://github.com/Turbo87/leaflet-sidebar.git"), script = "src/L.Control.Sidebar.js")registerPlugin <- function(map, plugin) { map$dependencies <- c(map$dependencies, list(plugin)) map}testLeaflet <- leaflet() %>% addTiles %>% addPolylines(data = dijkjson)%>% #register plugin on this map instance registerPlugin(sidebarPlugin)%>% addControl("Test2", position = "topright")%>% # Add your custom JS logic here. The `this` keyword # refers to the Leaflet (JS) map object. onRender("function(el, x) { var sidebar = L.control.sidebar('sidebar', { position: 'left'}).addTo(this); map.addControl(sidebar).addTo(this); sidebar.show().addTo(this); }")
在 R Leaflet 中實(shí)現(xiàn)一個(javascript)插件
慕碼人2483693
2023-02-23 10:05:52