InfoWindowExample.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div>
  3. <InfoWindow ref="infoWindowRef" :info-window-no="infoWindowNo" :multiple="true" :is-search-widget="true">
  4. <template #customButton>
  5. <a-button :icon="h(PlusCircleTwoTone)" @click="getSelectModelData">自定义按钮</a-button>
  6. <a-button :icon="h(PlusCircleTwoTone)" @click="getSelectModelData">自定义按钮</a-button>
  7. </template>
  8. <template #customContent>
  9. <div>这是自定义内容</div>
  10. </template>
  11. </InfoWindow>
  12. </div>
  13. </template>
  14. <script setup>
  15. import InfoWindow from '@/info/index.js';
  16. import { ref, getCurrentInstance, h, onMounted } from 'vue';
  17. import { PlusCircleTwoTone } from '@ant-design/icons-vue';
  18. const infoWindowNo = ref(null);
  19. const infoWindowRef = ref(null);
  20. const { proxy } = getCurrentInstance(); //访问this
  21. onMounted(() => {
  22. getInfoWindowNo();
  23. });
  24. const getInfoWindowNo = () => {
  25. if (proxy.$route.params != undefined) {
  26. var routeInfoWindowNo = proxy.$route.params.infoWindowNo;
  27. if (infoWindowNo.value != routeInfoWindowNo) {
  28. infoWindowNo.value = routeInfoWindowNo;
  29. console.log('open info window: ' + routeInfoWindowNo);
  30. }
  31. }
  32. };
  33. const getSelectModelData = () => {
  34. const selectDatas = infoWindowRef.value.getSelectedModelDatas();
  35. console.log(selectDatas, '---');
  36. };
  37. </script>