當(dāng)您單擊傳單地圖上的標(biāo)記時(shí),我想要做的是有一個(gè)彈出框。在這個(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è)圖像按鈕,則會顯示新圖像,我正在嘗試做什么。但是現(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 框架。
如何在傳單彈出 HTML 中調(diào)用 Javascript 函數(shù)
浮云間
2022-07-01 10:30:32