<!-- 地图选点弹窗 --> <script lang="ts" setup name="SelectMap"> // import MapComponent from '@/components/map/Map.vue' const $emits = defineEmits(['confirm']) const dialogFormVisible = ref(false) // 对话框是否显示 const location = ref() // const mapRef = ref() // const zoom = ref(18) // 初始化对话框 const initDialog = (data: any) => { dialogFormVisible.value = true } defineExpose({ initDialog, }) // 取消 const cancel = () => { dialogFormVisible.value = false } // 确认 const confirm = () => { cancel() $emits('confirm', location.value) } const selectMarker = (data: any) => { // $emits('confirm', data) location.value = data } </script> <template> <el-dialog v-model="dialogFormVisible" title="地图选点" append-to-body width="50%"> <div class="container"> <!-- <map-component ref="mapRef" :zoom="zoom" /> --> <marker-map @confirm="selectMarker" /> </div> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="confirm"> 确认 </el-button> <el-button type="info" @click="cancel"> 取消 </el-button> </div> </template> </el-dialog> </template> <style lang="scss" scoped> .container { width: 100%; height: 500px; overflow: hidden; } .el-dialog { width: 700px; } .el-select { width: 100%; } </style>