mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-23 23:29:41 +02:00
Basic nutrition editor (#288)
* Basic nutrition editor * fix no image on scrape * nutrition display * add recipe images * update by url * new upload options Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
2a158ab290
commit
406dae6e97
10 changed files with 234 additions and 29 deletions
|
@ -1,7 +1,12 @@
|
|||
<template>
|
||||
<v-form ref="file">
|
||||
<input ref="uploader" class="d-none" type="file" @change="onFileChanged" />
|
||||
<v-btn :loading="isSelecting" @click="onButtonClick" color="accent" text>
|
||||
<v-btn
|
||||
:loading="isSelecting"
|
||||
@click="onButtonClick"
|
||||
color="accent"
|
||||
:text="textBtn"
|
||||
>
|
||||
<v-icon left> {{ icon }}</v-icon>
|
||||
{{ text ? text : defaultText }}
|
||||
</v-btn>
|
||||
|
@ -13,10 +18,17 @@ const UPLOAD_EVENT = "uploaded";
|
|||
import { api } from "@/api";
|
||||
export default {
|
||||
props: {
|
||||
post: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
url: String,
|
||||
text: { default: "Upload" },
|
||||
icon: { default: "mdi-cloud-upload" },
|
||||
fileName: { default: "archive" },
|
||||
textBtn: {
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data: () => ({
|
||||
file: null,
|
||||
|
@ -33,6 +45,12 @@ export default {
|
|||
async upload() {
|
||||
if (this.file != null) {
|
||||
this.isSelecting = true;
|
||||
|
||||
if (this.post) {
|
||||
this.$emit(UPLOAD_EVENT, this.file);
|
||||
this.isSelecting = false;
|
||||
return;
|
||||
}
|
||||
let formData = new FormData();
|
||||
formData.append(this.fileName, this.file);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue