Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1

Using Vue-Router Dynamic Routes to Load Data Chapter 9


<td>{{ variation.quantity }}</td>
<td>\${{ variation.price }}</td>
<td><button>Add to basket</button></td>
</tr>
</table>
</div>

<div v-html="product.body"></div>

</div>
<page-not-found v-if="productNotFound"></page-not-found>
</div>`,

components: {
PageNotFound
},
data() {
return {
productNotFound: false,
image: false
}
},

computed: {
...
},

methods: {
updateImage(img) {
this.image = img;
},

variantTitle(variation) {
let variants = variation.variant,
output = [];

for(let a in variants) {
output.push(`<b>${variants[a].name}:</b> ${variants[a].value}`);
}

return output.join(' / ');
}

}
};
Free download pdf