mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
		| @@ -1,20 +1,44 @@ | ||||
| <template> | ||||
|   <v-item-group> | ||||
|     <template v-for="btn in buttons"> | ||||
|       <v-menu v-if="btn.children" :key="'menu-' + btn.event" active-class="pa-0" offset-y top left :style="stretch ? 'width: 100%;' : ''"> | ||||
|         <template #activator="{ on, attrs }"> | ||||
|           <v-btn tile :large="large" icon v-bind="attrs" v-on="on"> | ||||
|       <v-menu | ||||
|         v-if="btn.children" | ||||
|         :key="'menu-' + btn.event" | ||||
|         active-class="pa-0" | ||||
|         offset-y | ||||
|         top | ||||
|         start | ||||
|         :style="stretch ? 'width: 100%;' : ''" | ||||
|       > | ||||
|         <template #activator="{ props }"> | ||||
|           <v-btn | ||||
|             tile | ||||
|             :large="large" | ||||
|             icon | ||||
|             variant="plain" | ||||
|             v-bind="props" | ||||
|           > | ||||
|             <v-icon> | ||||
|               {{ btn.icon }} | ||||
|             </v-icon> | ||||
|           </v-btn> | ||||
|         </template> | ||||
|         <v-list dense> | ||||
|           <template v-for="(child, idx) in btn.children"> | ||||
|             <v-list-item :key="idx" dense @click="$emit(child.event)"> | ||||
|         <v-list density="compact"> | ||||
|           <template | ||||
|             v-for="(child, idx) in btn.children" | ||||
|             :key="idx" | ||||
|           > | ||||
|             <v-list-item | ||||
|               density="compact" | ||||
|               @click="$emit(child.event)" | ||||
|             > | ||||
|               <v-list-item-title>{{ child.text }}</v-list-item-title> | ||||
|             </v-list-item> | ||||
|             <v-divider v-if="child.divider" :key="`divider-${idx}`" class="my-1"></v-divider> | ||||
|             <v-divider | ||||
|               v-if="child.divider" | ||||
|               :key="`divider-${idx}`" | ||||
|               class="my-1" | ||||
|             /> | ||||
|           </template> | ||||
|         </v-list> | ||||
|       </v-menu> | ||||
| @@ -23,11 +47,11 @@ | ||||
|         :key="'btn-' + btn.event" | ||||
|         open-delay="200" | ||||
|         transition="slide-y-reverse-transition" | ||||
|         dense | ||||
|         density="compact" | ||||
|         bottom | ||||
|         content-class="text-caption" | ||||
|       > | ||||
|         <template #activator="{ on, attrs }"> | ||||
|         <template #activator="{ props }"> | ||||
|           <v-btn | ||||
|             tile | ||||
|             icon | ||||
| @@ -35,8 +59,8 @@ | ||||
|             :large="large" | ||||
|             :disabled="btn.disabled" | ||||
|             :style="stretch ? `width: ${maxButtonWidth};` : ''" | ||||
|             v-bind="attrs" | ||||
|             v-on="on" | ||||
|             variant="plain" | ||||
|             v-bind="props" | ||||
|             @click="$emit(btn.event)" | ||||
|           > | ||||
|             <v-icon> {{ btn.icon }} </v-icon> | ||||
| @@ -49,8 +73,6 @@ | ||||
| </template> | ||||
|  | ||||
| <script lang="ts"> | ||||
| import { computed, defineComponent } from "@nuxtjs/composition-api"; | ||||
|  | ||||
| export interface ButtonOption { | ||||
|   icon?: string; | ||||
|   color?: string; | ||||
| @@ -61,7 +83,7 @@ export interface ButtonOption { | ||||
|   divider?: boolean; | ||||
| } | ||||
|  | ||||
| export default defineComponent({ | ||||
| export default defineNuxtComponent({ | ||||
|   props: { | ||||
|     buttons: { | ||||
|       type: Array as () => ButtonOption[], | ||||
| @@ -74,13 +96,13 @@ export default defineComponent({ | ||||
|     stretch: { | ||||
|       type: Boolean, | ||||
|       default: false, | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
|   setup(props) { | ||||
|     const maxButtonWidth = computed(() => `${100 / props.buttons.length}%`); | ||||
|     return { | ||||
|       maxButtonWidth, | ||||
|     }; | ||||
|   } | ||||
|   }, | ||||
| }); | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user