|
1 | 1 | <script setup lang="ts" generic="GenericOption extends Option<OptionValue>, OptionValue = string">
|
| 2 | +import type { HTMLAttributes } from "vue"; |
2 | 3 | import type { Option } from "./types/option";
|
3 | 4 | import type { Props } from "./types/props";
|
4 | 5 | import type { Slots } from "./types/slots";
|
5 |
| -import { computed, provide, ref, useTemplateRef, watch } from "vue"; |
| 6 | +import { computed, provide, ref, useAttrs, useTemplateRef, watch } from "vue"; |
6 | 7 | import Indicators from "./Indicators.vue";
|
7 | 8 | import { DATA_KEY, PROPS_KEY } from "./lib/provide-inject";
|
8 | 9 | import { uniqueId } from "./lib/uid";
|
@@ -50,6 +51,9 @@ const emit = defineEmits<{
|
50 | 51 | const slots = defineSlots<Slots<GenericOption, OptionValue>>();
|
51 | 52 | const selected = defineModel<OptionValue | OptionValue[]>({ required: true });
|
52 | 53 |
|
| 54 | +const attrs = useAttrs(); |
| 55 | +const rootClass = computed(() => attrs.class as HTMLAttributes["class"]); |
| 56 | +
|
53 | 57 | const containerRef = useTemplateRef("container");
|
54 | 58 | const inputRef = useTemplateRef("input");
|
55 | 59 | const indicatorsRef = useTemplateRef("indicators");
|
@@ -447,6 +451,7 @@ watch(
|
447 | 451 | <Menu
|
448 | 452 | v-if="menuOpen"
|
449 | 453 | v-model="selected"
|
| 454 | + :root-class="rootClass" |
450 | 455 | :slots="{
|
451 | 456 | 'option': slots.option,
|
452 | 457 | 'menu-header': slots['menu-header'],
|
|
0 commit comments