| | |
| | | const containerRef = ref<HTMLDivElement>(null); |
| | | const props = defineProps(['data']); |
| | | |
| | | const emit = defineEmits(['equipClick']) |
| | | const emit = defineEmits(['equipClick','closeInfoWindow']); |
| | | const createInfoWindow = () => { |
| | | // title |
| | | // <div class="title flex-center bg-[#ca0dab] text-white py-0.5 mb-2 w-full over-ellipsis"> |
| | |
| | | const updateInfoWindow = (item) => { |
| | | const cellHeight = '20px'; |
| | | const keyListDom = infoWindow.dom.querySelector('.key-list'); |
| | | const valueListDom = infoWindow.dom.querySelector('.value-list') |
| | | const valueListDom = infoWindow.dom.querySelector('.value-list'); |
| | | |
| | | const colsArray = props.data.cols ?? []; |
| | | const keyItemHtml = colsArray |
| | | .map((col) => { |
| | | return `<span class="flex-items-center justify-start" style="height:${cellHeight}">${col.title??''}</span>`; |
| | | return `<span class="flex-items-center justify-start" style="height:${cellHeight}">${col.title ?? ''}</span>`; |
| | | }) |
| | | .join(''); |
| | | |
| | | const valueItemHtml = colsArray |
| | | .map((col, index) => { |
| | | return `<span class="flex-items-center justify-end" style="height:${cellHeight}">${item[index] ??''}</span>`; |
| | | return `<span class="flex-items-center justify-end" style="height:${cellHeight}">${item[index] ?? ''}</span>`; |
| | | }) |
| | | .join(''); |
| | | |
| | |
| | | // } |
| | | infoWindow.open(gaoDeMap.map, label.getPosition() as any); |
| | | const extData = label.getExtData(); |
| | | emit('equipClick',extData); |
| | | emit('equipClick', extData); |
| | | updateInfoWindow(extData); |
| | | }, |
| | | }, |
| | |
| | | anchor: 'top-left', |
| | | closeWhenClickMap: true, |
| | | }); |
| | | const closeBtnDom = infoWindow.dom.querySelector('.amap-info-close'); |
| | | closeBtnDom.addEventListener('click', () => { |
| | | emit('closeInfoWindow'); |
| | | }); |
| | | }); |
| | | </script> |
| | | <style scoped lang="scss"> |