1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-23 15:19:41 +02: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:
Hoa (Kyle) Trinh 2025-06-20 00:09:12 +07:00 committed by GitHub
parent 89ab7fac25
commit c24d532608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
403 changed files with 23959 additions and 19557 deletions

View file

@ -1,18 +1,19 @@
<template>
<v-btn
:color="color || btnAttrs.color"
:small="small"
:size="small ? 'small' : 'default'"
:x-small="xSmall"
:loading="loading"
:disabled="disabled"
:outlined="btnStyle.outlined"
:text="btnStyle.text"
:variant="disabled ? 'tonal' : btnStyle.outlined ? 'outlined' : btnStyle.text ? 'text' : 'elevated'"
:to="to"
v-bind="$attrs"
v-on="$listeners"
@click="download ? downloadFile() : undefined"
>
<v-icon v-if="!iconRight" left>
<v-icon
v-if="!iconRight"
start
>
<slot name="icon">
{{ icon || btnAttrs.icon }}
</slot>
@ -20,7 +21,10 @@
<slot name="default">
{{ text || btnAttrs.text }}
</slot>
<v-icon v-if="iconRight" right>
<v-icon
v-if="iconRight"
end
>
<slot name="icon">
{{ icon || btnAttrs.icon }}
</slot>
@ -29,10 +33,9 @@
</template>
<script lang="ts">
import { computed, defineComponent, useContext } from "@nuxtjs/composition-api";
import { useUserApi } from "~/composables/api";
export default defineComponent({
export default defineNuxtComponent({
name: "BaseButton",
props: {
// Types
@ -117,7 +120,8 @@ export default defineComponent({
},
},
setup(props) {
const { $globals, i18n } = useContext();
const i18n = useI18n();
const { $globals } = useNuxtApp();
const buttonOptions = {
create: {
text: i18n.t("general.create"),
@ -159,15 +163,20 @@ export default defineComponent({
const btnAttrs = computed(() => {
if (props.delete) {
return buttonOptions.delete;
} else if (props.update) {
}
else if (props.update) {
return buttonOptions.update;
} else if (props.edit) {
}
else if (props.edit) {
return buttonOptions.edit;
} else if (props.cancel) {
}
else if (props.cancel) {
return buttonOptions.cancel;
} else if (props.save) {
}
else if (props.save) {
return buttonOptions.save;
} else if (props.download) {
}
else if (props.download) {
return buttonOptions.download;
}
return buttonOptions.create;
@ -191,7 +200,8 @@ export default defineComponent({
const btnStyle = computed(() => {
if (props.secondary) {
return buttonStyles.secondary;
} else if (props.minor || props.cancel) {
}
else if (props.minor || props.cancel) {
return buttonStyles.minor;
}
return buttonStyles.defaults;