{{ $t("recipe.yield") }}
- {{ text }}
+
@@ -34,7 +34,7 @@ export default defineNuxtComponent({
type: Number,
default: 0,
},
- yield: {
+ yieldText: {
type: String,
default: "",
},
@@ -55,15 +55,24 @@ export default defineNuxtComponent({
});
}
- const scaledAmount = computed(() => {
+ const yieldDisplay = computed(() => {
+ const components: string[] = [];
+
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.yield);
return {
- scaledAmount,
- text,
+ yieldDisplay,
};
},
});