@MohamedTammam I have identified two situations for which I get this warning.
First situation (not solved yet)
I have the form and two buttons to open the form with levelId null or not null.
<level-form
:dialogVisible="dialogLevel"
:levelId="levelId"
@close="closeDialogLevel()">
</level-form>
...
data() {
return {
levelId: Number,
dialogLevel: false,
}
},
...
@click="createLevel()" // click for button to create a new level
@click="openDialogLevel(scope.row.id)" // click for button to edit an existing level in a table
...
openDialogLevel(levelId) {
this.levelId = levelId
this.dialogLevel = true
},
createLevel() {
this.openDialogLevel(0)
},
And the child component with the props.
props: {
dialogVisible: Boolean,
levelId: Number
},
I have tried Lary AI's suggestion, it works when I add Function as a possible type for the id, but I don't think that it's a solution, because the id can only be a number or null.
Second situation (now solved)
I don't have a table but I directly open a view that contains the details for a student. In this view I need to have the student id passed by param in the URL.
<sessions-list :studentId="studentId"></sessions-list>
data() {
return {
studentId: Number,
dialogStudent: false,
}
},
mount() {
this.studentId = parseInt(this.$route.params.id)
}
I have moved this code into a computed property and I don't get the warning any more.
computed: {
studentId() {
return parseInt(this.$route.params.id)
}
},