Component
props: { image: { type: String, default() { return this.defaultImage } }},computed: { defaultImage() { return this.$config.baseUrl +'/images/default.jpg' }},
Using the above component, when prop-image is not present, the component returns default-image successfully.
<image-uplaoder />
But I want to achieve, if I pass the value for prop-image and the value is null, it should still return default-image. Currently, it returns nothing.
<image-uplaoder :image="data.image" />
Tried (can't we do something like) as follows?
computed: { defaultImage(value) { if(!value || value === null) { return this.$config.baseUrl +'/images/default.jpg' } }},