2.5.17
https://jsfiddle.net/j97btnex/35/
Child component should use default value. When parent send null in props.
Parent
<child :data="some_data_that_give_null_value"
></child>
Child.
<script>
export default {
props: {
data: {
type: Number,
default: 99,
},
},
mounted() {
console.log(data);
},
}
</script>
I imagine this would break quite a few things. If you want the default value, pass undefined instead.
As @KaelWD said...
@KaelWD Thanks, But How? Can you give me an example.
Just convert null values to undefined before you pass them into the prop, or just don't produce nullable values before this.
@KaelWD Thank you so much.
Most helpful comment
I imagine this would break quite a few things. If you want the default value, pass
undefinedinstead.