1π
β
The problem is that you try to access props variable directly from your template. To solve this, initalize a state variable (under data {}) Within props value as default like you did With picsNeW
.
another remark, avoid to use βthisβ from template, you should access directly datas form its name. Use default value in your props, this is recommended π
π€balzacLeGeek
2π
The line {{ this.galCode }}{{ photo.filename }}
should be {{ galCode }}{{ photo.filename }}
. Your problem is the this
you added
π€Emmanuel Ogoma
1π
First you should define Default value as :
props: {
name: {
type: String,
default: 'default'
},
...
galCode: {
type: Number,
default: 0
},
},
Second be sure you receive desired data, specially in nested object you should check the object defined to prevent receive undefined property error, like use v-if
:
<header>
<template v-if="galCode">{{ galCode }}</template> // can use v-else here too print default value
<template v-if="photo.filename"> {{ photo.filename }}</template>
</header>
π€Mohsen
Source:stackexchange.com