|
@@ -20,9 +20,10 @@
|
|
|
ref="infoWindowRef"
|
|
ref="infoWindowRef"
|
|
|
:visible="showInfoWindow"
|
|
:visible="showInfoWindow"
|
|
|
:position="currentMarker"
|
|
:position="currentMarker"
|
|
|
- :content="tunnelContent"
|
|
|
|
|
@closeclick="closeInfo"
|
|
@closeclick="closeInfo"
|
|
|
- />
|
|
|
|
|
|
|
+ >
|
|
|
|
|
+ <div>打开</div>
|
|
|
|
|
+ </tlbs-info-window>
|
|
|
<div class="control-container">
|
|
<div class="control-container">
|
|
|
<button @click.stop="getLayerInstance">
|
|
<button @click.stop="getLayerInstance">
|
|
|
打印点标记实例
|
|
打印点标记实例
|
|
@@ -117,14 +118,25 @@ export default defineComponent({
|
|
|
const closeInfo = () => {
|
|
const closeInfo = () => {
|
|
|
showInfoWindow.value = false
|
|
showInfoWindow.value = false
|
|
|
}
|
|
}
|
|
|
- const openData = () => {
|
|
|
|
|
- console.log('数据')
|
|
|
|
|
- }
|
|
|
|
|
const onContentMounted = () => {
|
|
const onContentMounted = () => {
|
|
|
}
|
|
}
|
|
|
// document.getElementById('data').addEventListener('click',function() {
|
|
// document.getElementById('data').addEventListener('click',function() {
|
|
|
// alert('绑定事件监听函数')
|
|
// alert('绑定事件监听函数')
|
|
|
// })
|
|
// })
|
|
|
|
|
+ const openData = (marker, infoWindow) => {
|
|
|
|
|
+ // 可以在这里处理信息窗口中的按钮点击事件
|
|
|
|
|
+ // 由于信息窗口是动态创建的,需要使用事件委托
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ const btn = document.querySelector('.info-btn')
|
|
|
|
|
+ if (btn) {
|
|
|
|
|
+ btn.addEventListener('click', (e) => {
|
|
|
|
|
+ e.stopPropagation()
|
|
|
|
|
+ console.log('按钮被点击', marker)
|
|
|
|
|
+ // 在这里处理按钮点击逻辑
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 100)
|
|
|
|
|
+ }
|
|
|
return {
|
|
return {
|
|
|
center,
|
|
center,
|
|
|
zoom,
|
|
zoom,
|