How to solve the problem that the bound data in the template of vue.js reports an error as `undefined`?

in < template > of the Vue.js project:

<td>{{data.name}}</td>

there is such insert data here, please tell me:

if data does not have name, an error will be reported here. Is there any way to give it a default value in the template?

for example: give an empty string if there is no name,.

is it stated in the official document that I can"t find it?

Mar.02,2021

try this: {{data.name? Data.name:''}


<td v-text="data.name?data.name:''"></td>

{{data.name | | 'default'}}

Menu