mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-04 03:03:18 -05:00 
			
		
		
		
	Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
		
			
				
	
	
		
			42 lines
		
	
	
		
			688 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			688 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
  <component :is="tag">
 | 
						|
    <slot
 | 
						|
      name="activator"
 | 
						|
      v-bind="{ toggle, state }"
 | 
						|
    />
 | 
						|
    <slot v-bind="{ state, toggle }" />
 | 
						|
  </component>
 | 
						|
</template>
 | 
						|
 | 
						|
<script lang="ts">
 | 
						|
export default defineNuxtComponent({
 | 
						|
  props: {
 | 
						|
    modelValue: {
 | 
						|
      type: Boolean,
 | 
						|
      default: false,
 | 
						|
    },
 | 
						|
    tag: {
 | 
						|
      type: String,
 | 
						|
      default: "div",
 | 
						|
    },
 | 
						|
  },
 | 
						|
  emits: ["update:modelValue"],
 | 
						|
  setup(props, context) {
 | 
						|
    const state = ref(false);
 | 
						|
 | 
						|
    const toggle = () => {
 | 
						|
      state.value = !state.value;
 | 
						|
    };
 | 
						|
 | 
						|
    watch(state, () => {
 | 
						|
      context.emit("update:modelValue", state.value);
 | 
						|
    });
 | 
						|
 | 
						|
    return {
 | 
						|
      state,
 | 
						|
      toggle,
 | 
						|
    };
 | 
						|
  },
 | 
						|
});
 | 
						|
</script>
 |