I'm currently facing an issue with my "Product" component where the data from the parent is not being passed to the child. It seems to be stuck at the default value entered in the main template. The shipping cost should be either free or $2.69 depending on the premium value.
Despite watching VueMastery introduction videos, I am still struggling to understand the issue. Can someone please provide a clear explanation of what the problem might be?
var app = new Vue({
el: '#app',
data: {
premium: false // Changing the value here doesn't seem to have any effect
}
})
Vue.component('product', {
props: {
premium: {
type: Boolean,
required: true
}
},
template: ``,
data() {},
computed: {
shipping() {
if(this.premium) {
return "Free";
}
return 2.69;
}
}
}
<div id="app">
<product :premium="true"></product> // Changing this value seems to work..
</div
Any help on this matter would be greatly appreciated.