0👍
Use a computed property.
computed: {
title: function() {
return this.value ? this.value.age : ''
}
}
In this way we are ensuring that this.value
is not undefined
and we use the age
off of the object, otherwise an empty string (or you can replace it with whatever you want. Now just use that as the title property:
:title="title"
Source:stackexchange.com