Skip to content

Commit

Permalink
fix: expose custom marker
Browse files Browse the repository at this point in the history
  • Loading branch information
HusamElbashir authored Jun 19, 2023
1 parent d21dfba commit 68f5a3e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/CustomMarker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</template>

<script lang="ts">
import { defineComponent, PropType, ref, computed, Comment, onMounted } from "vue";
import { defineComponent, PropType, ref, computed, Comment } from "vue";
import { customMarkerClassSymbol } from "../shared/index";
import { useSetupMapComponent } from "../composables/index";
Expand All @@ -21,17 +21,18 @@ export default defineComponent({
},
},
setup(props, { slots, emit }) {
setup(props, { slots, emit, expose }) {
const customMarkerRef = ref<HTMLElement>();
let customMarker = ref<InstanceType<typeof google.maps.CustomMarker>>();
const hasSlotContent = computed(() => slots.default?.().some((vnode) => vnode.type !== Comment));
const options = computed(() => ({
...props.options,
element: customMarkerRef.value,
}));
onMounted(() => {
customMarker = useSetupMapComponent(customMarkerClassSymbol, [], options, emit);
const customMarker = useSetupMapComponent(customMarkerClassSymbol, [], options, emit);
expose({
customMarker,
});
return { customMarkerRef, customMarker, hasSlotContent };
Expand Down

0 comments on commit 68f5a3e

Please sign in to comment.