我想做的是當(dāng)您單擊傳單地圖上的標(biāo)記時(shí)有一個(gè)彈出框。在此彈出框中存在五個(gè)元素。標(biāo)題描述圖像按鈕(下一張圖片)按鈕(上一張圖片)所以我嘗試做的是為每個(gè)功能添加一個(gè)自定義彈出窗口: onEachFeature: function(feature, layer) {
layer.bindPopup(insertDataPopUp(feature), customPopUpOptions);
}但是在我的彈出設(shè)置中,當(dāng)我在 HTML 中調(diào)用 onclick 函數(shù)時(shí),該函數(shù)無法識別。因此,如果有人單擊下一個(gè)圖像按鈕,我會(huì)嘗試做的事情是顯示新圖像。但現(xiàn)在的問題是HTML中找不到該函數(shù)......以下是問題所在的彈出窗口的代碼:function insertDataPopUp(feature) { if (feature.properties.pictures != null) { var picturePath = feature.properties.pictures[0]; var picture = "<img id='popupFoto' src=" + picturePath + " alt=''/>"; } else { picture = ""; } var customPopup = "<div id='infoBox'><h2>" + feature.properties.name + "</h2><p>" + feature.properties.description + "</p>" + picture + '<button onclick="nextFoto()">Back</button> <button onclick="nextFoto()">Forward</button></div>'; return customPopup; }我正在使用傳單、javascript 和 vue 框架。
- 1 回答
- 0 關(guān)注
- 129 瀏覽
添加回答
舉報(bào)
0/150
提交
取消