This will help you.
https://vuejs.org/guide/components/props.html#prop-validation
export default {
props: {
month_id: {
type: typeValue,
default: defaultValue,
...
}
},
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a child component like below.
<script>
export default {
props: ['mosque_id','month_id'],
data(){
return {
prayer_times: [],
}
},
watch: {
month_id() {
this.getPrayerTime();
}
},
methods:{
getPrayerTime: function () {
axios.get('/api/v1/getPrayerTime/'+ this.mosque_id+'/'+ this.month_id)
.then(function (response) {
this.prayer_times = response.data;
}.bind(this));
}
}
}
</script>
I would like to set Default value for month_id to work on component first load time. Later it will update by parent component.
Please or to participate in this conversation.