From 74f3e71763455da9d30e2c9e957e9d3364939a32 Mon Sep 17 00:00:00 2001 From: matthew44-mappable <155086725+matthew44-mappable@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:28:43 +0300 Subject: [PATCH] Fix ignore props.popup.content in Vue MMapDefaultMarker (#32) Fixes #31 --- src/markers/MMapDefaultMarker/vue/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/markers/MMapDefaultMarker/vue/index.ts b/src/markers/MMapDefaultMarker/vue/index.ts index 91e2171..b9a9cca 100644 --- a/src/markers/MMapDefaultMarker/vue/index.ts +++ b/src/markers/MMapDefaultMarker/vue/index.ts @@ -54,17 +54,22 @@ export const MMapDefaultMarkerVuefyOverride: CustomVuefyFn = props, slots: Object as TVue.SlotsType, setup(props, {slots, expose}) { - const content: TVue.Ref = Vue.ref(null); + const content: TVue.Ref = Vue.ref(null); const popupHTMLElement = document.createElement('mappable'); const markerRef = Vue.ref<{entity: MMapDefaultMarker} | null>(null); const markerEntity = Vue.computed(() => markerRef.value?.entity); const popup = Vue.computed(() => { - if (slots.popupContent === undefined) { + if (slots.popupContent === undefined && props.popup?.content === undefined) { return undefined; } - content.value = slots.popupContent(); + + if (typeof props.popup?.content === 'string') { + content.value = props.popup.content; + } else { + content.value = slots.popupContent?.(); + } return {...props.popup, content: () => popupHTMLElement}; }); expose({entity: markerEntity});