Fixed product link update bug
This commit is contained in:
parent
1ad41888f9
commit
1856db28be
2 changed files with 9 additions and 4 deletions
|
|
@ -2,7 +2,6 @@
|
|||
<div class="ingredient-add-box">
|
||||
<p class="ingredient-line">
|
||||
<ingredient-line :ingredient="ingredient"
|
||||
:show-expanded="true"
|
||||
@update-ingredient="updateIngredient"
|
||||
@update-product-link="updateProduct"
|
||||
@delete-item="deleteIngredient" />
|
||||
|
|
|
|||
|
|
@ -17,17 +17,23 @@ import CompactParsedIngredient from './CompactParsedIngredient.vue';
|
|||
export default {
|
||||
props: {
|
||||
ingredient: { type: Object },
|
||||
showExpanded: { type: Boolean, default: false }
|
||||
},
|
||||
events: ['update-ingredient', 'update-product-link'],
|
||||
components: { CompactParsedIngredient },
|
||||
data() {
|
||||
return {
|
||||
ingredientText: this.ingredient.line,
|
||||
productLink: this.ingredient.product?.product_link ?? "",
|
||||
showDetails: this.showExpanded
|
||||
productLink: this.ingredient.product?.link ?? "",
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
ingredient: {
|
||||
handler: function (newIngredient) {
|
||||
this.productLink = newIngredient.product?.link ?? "";
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateIngredient() {
|
||||
if (this.ingredientText != this.ingredient.line)
|
||||
|
|
|
|||
Loading…
Reference in a new issue