mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
restore hiding scale edit if nothing is parsed
This commit is contained in:
parent
1e56fac224
commit
eb1c798b70
1 changed files with 13 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
v-if="!isEditMode"
|
||||
v-model.number="scaleValue"
|
||||
:recipe-servings="recipeServings"
|
||||
:edit-scale="!isEditMode"
|
||||
:edit-scale="hasFoodOrUnit && !isEditMode"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -37,6 +37,17 @@ export default defineNuxtComponent({
|
|||
return props.recipe.recipeServings || props.recipe.recipeYieldQuantity || 1;
|
||||
});
|
||||
|
||||
const hasFoodOrUnit = computed(() => {
|
||||
if (props.recipe.recipeIngredient) {
|
||||
for (const ingredient of props.recipe.recipeIngredient) {
|
||||
if (ingredient.food || ingredient.unit) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
const scaleValue = computed<number>({
|
||||
get() {
|
||||
return props.scale;
|
||||
|
@ -50,6 +61,7 @@ export default defineNuxtComponent({
|
|||
recipeServings,
|
||||
scaleValue,
|
||||
isEditMode,
|
||||
hasFoodOrUnit,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue