mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
simplify/combine yield amount and text
This commit is contained in:
parent
bc6f2cdba6
commit
a074cff779
1 changed files with 16 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="scaledAmount"
|
v-if="yieldDisplay"
|
||||||
class="d-flex align-center"
|
class="d-flex align-center"
|
||||||
>
|
>
|
||||||
<v-row
|
<v-row
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<p class="my-0 opacity-80">
|
<p class="my-0 opacity-80">
|
||||||
<span class="font-weight-bold">{{ $t("recipe.yield") }}</span><br>
|
<span class="font-weight-bold">{{ $t("recipe.yield") }}</span><br>
|
||||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
<span v-html="scaledAmount" /> {{ text }}
|
<span v-html="yieldDisplay" />
|
||||||
</p>
|
</p>
|
||||||
</v-row>
|
</v-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,15 +55,24 @@ export default defineNuxtComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const scaledAmount = computed(() => {
|
const yieldDisplay = computed<string>(() => {
|
||||||
|
const components: string[] = [];
|
||||||
|
|
||||||
const { scaledAmountDisplay } = useScaledAmount(props.yieldQuantity, props.scale);
|
const { scaledAmountDisplay } = useScaledAmount(props.yieldQuantity, props.scale);
|
||||||
return scaledAmountDisplay;
|
if (scaledAmountDisplay) {
|
||||||
|
components.push(scaledAmountDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = props.yieldText;
|
||||||
|
if (text) {
|
||||||
|
components.push(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sanitizeHTML(components.join(" "));
|
||||||
});
|
});
|
||||||
const text = sanitizeHTML(props.yieldText);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
scaledAmount,
|
yieldDisplay,
|
||||||
text,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue