mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
37 lines
671 B
Vue
37 lines
671 B
Vue
<template>
|
|
<component :is="tag">
|
|
<slot name="activator" v-bind="{ toggle, state }"> </slot>
|
|
<slot v-bind="{ state, toggle }"></slot>
|
|
</component>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, watch } from "@nuxtjs/composition-api";
|
|
import { useToggle } from "@vueuse/core";
|
|
|
|
export default defineComponent({
|
|
props: {
|
|
value: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
tag: {
|
|
type: String,
|
|
default: "div",
|
|
},
|
|
},
|
|
setup(_, context) {
|
|
const [state, toggle] = useToggle();
|
|
|
|
watch(state, () => {
|
|
context.emit("input", state);
|
|
});
|
|
|
|
return {
|
|
state,
|
|
toggle,
|
|
};
|
|
},
|
|
});
|
|
</script>
|