| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <template>
- <div>
- <InfoWindow ref="infoWindowRef" :info-window-no="infoWindowNo" :multiple="true" :is-search-widget="false">
- <template #customButton>
- <a-button :icon="h(PlusCircleTwoTone)" @click="getSelectModelData">自定义按钮</a-button>
- <a-button :icon="h(PlusCircleTwoTone)" @click="getSelectModelData">自定义按钮</a-button>
- </template>
- <template #customContent>
- <div>这是自定义内容</div>
- </template>
- </InfoWindow>
- </div>
- </template>
- <script setup>
- import InfoWindow from '@/info/index.js';
- import { ref, getCurrentInstance, h, onMounted } from 'vue';
- import { PlusCircleTwoTone } from '@ant-design/icons-vue';
- const infoWindowNo = ref(null);
- const infoWindowRef = ref(null);
- const { proxy } = getCurrentInstance(); //访问this
- onMounted(() => {
- getInfoWindowNo();
- });
- const getInfoWindowNo = () => {
- if (proxy.$route.params != undefined) {
- var routeInfoWindowNo = proxy.$route.params.infoWindowNo;
- if (infoWindowNo.value != routeInfoWindowNo) {
- infoWindowNo.value = routeInfoWindowNo;
- console.log('open info window: ' + routeInfoWindowNo);
- }
- }
- };
- const getSelectModelData = () => {
- const selectDatas = infoWindowRef.value.getSelectedModelDatas();
- console.log(selectDatas, '---');
- };
- </script>
|