From 8195dc844a77ba2b28347a1ff67ae488621123d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20de=20Metz?= Date: Mon, 27 May 2024 15:19:16 +0200 Subject: [PATCH] Watch the className prop to update the popup. --- lib/components/controls/custom.control.ts | 2 +- lib/components/popup.component.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/components/controls/custom.control.ts b/lib/components/controls/custom.control.ts index 1f15d98..7df81bb 100644 --- a/lib/components/controls/custom.control.ts +++ b/lib/components/controls/custom.control.ts @@ -36,7 +36,7 @@ export default defineComponent({ */ class: { type: String as PropType, - default: 'maplibregl-ctrl maplibregl-ctrl-group', + default: "maplibregl-ctrl maplibregl-ctrl-group", }, }, slots: Object as SlotsType<{ default: unknown }>, diff --git a/lib/components/popup.component.ts b/lib/components/popup.component.ts index dd3b872..47c2edd 100644 --- a/lib/components/popup.component.ts +++ b/lib/components/popup.component.ts @@ -172,6 +172,17 @@ export default defineComponent({ () => props.maxWidth, (v) => popup.setMaxWidth(v), ); + watch( + () => props.className, + (value, previous) => { + if (previous) { + popup.removeClassName(p); + } + if (value) { + popup.addClassName(v); + } + }, + ); watch( () => props.subpixelPositioning, (v) => popup.setSubpixelPositioning(v),