mealie/frontend/components/global/ToggleState.vue
Hayden 2ce195a0d4
refactor: ♻️ rewrite migrations frontend/backend (#841)
* refactor(frontend): ♻️ rewrite migrations UI

* refactor(backend): ♻️ rewrite recipe migrations

* remove vue-demi

Co-authored-by: hay-kot <hay-kot@pm.me>
2021-11-26 22:37:06 -09:00

37 lines
No EOL
681 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/shared";
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>