如何在 Leaflet.js 标记上添加鼠标悬停弹出。弹出数据将是动态的。
我有一个服务,它返回一个纬度和经度位置,这些位置将在地图上标记。
我需要在鼠标上弹出一个标记。该事件应将 ex 的经纬度和多头头寸发送到:http : //api.openweathermap.org/data/2.5/weather? lat=40&lon=-100 来自服务的数据应在弹出内容中。我已经尝试过但无法动态构建每个标记的弹出内容
请只做那些需要的。
下面是我用于标记的代码 statesdata 是存储纬度和经度值的数组
for ( var i=0; i < totalLength1; i++ ) {
var LamMarker = new L.marker([statesData1[i].KK, statesData1[i].LL]).on('contextmenu',function(e) {
onClick(this, i);
}).on('click',function(e) {
onClick1(this, i)
});
marker_a1.push(LamMarker);
map.addLayer(marker_a1[i]);
Run Code Online (Sandbox Code Playgroud)
单击时,我们在标记的上下文中调用 click1 函数,我们调用单击函数
如何从上面的代码中添加鼠标经过纬度和经度的弹出窗口?
我在UI5应用程序的Component.js中声明了一个模型,如下所示
init: function() {
sap.ui.core.UIComponent.prototype.init.apply(this);
var oModel1 = new sap.ui.model.json.JSONModel("model/mock.json");
sap.ui.getCore().setModel(oModel1, "oModelForSales");
},
Run Code Online (Sandbox Code Playgroud)
但是无法onInit在控制器内部的任何方法中访问模型,除非在视图上设置模型,如下所示:
var oModel1 = new sap.ui.model.json.JSONModel("model/routes.json");
this.getView().setModel(oModel1);
Run Code Online (Sandbox Code Playgroud)
sap.ui.getCore().getModel("oModelForSales")控制器onInit中的日志显示模型为,undefined但我能够在onBeforeRendering处理程序中获取它.
为什么在Component.js中设置的核心模型无法访问onInit?
例如
String temp = "welcome,to,the,world,of,j2ee";
Run Code Online (Sandbox Code Playgroud)
将其转换为arraylist
ArrayList al= new ArrayList(temp.split(","));
Run Code Online (Sandbox Code Playgroud)
这是作为arraylist的内容 {"welcome","to","the","world","j2ee"}
我的要求是在每个字符串的末尾添加"^ d"
对于前 {"welcome^d","to^d","the^d","world^d","j2ee^d"}