我想做的是當您單擊傳單地圖上的標記時有一個彈出框。在此彈出框中存在五個元素。標題描述圖像按鈕(下一張圖片)按鈕(上一張圖片)所以我嘗試做的是為每個功能添加一個自定義彈出窗口: onEachFeature: function(feature, layer) {
layer.bindPopup(insertDataPopUp(feature), customPopUpOptions);
}但是在我的彈出設置中,當我在 HTML 中調用 onclick 函數時,該函數無法識別。因此,如果有人單擊下一個圖像按鈕,我會嘗試做的事情是顯示新圖像。但現在的問題是HTML中找不到該函數......以下是問題所在的彈出窗口的代碼: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 框架。
添加回答
舉報
0/150
提交
取消