1👍
✅
You can’t use computed properties like this, instead you can create method
iconType(item){
let type = item.item_type
if(type === 'link'){
return "link"
} else {
return 'double_arrow'
}
}
and use it like <q-icon :name="iconType(item)" />
for cleaner code you may try this approach
iconType(item) {
return {
link: 'link',
otherType: 'otherIcon'
}[item.itemType] || 'double_arrow'
}
2👍
You don’t need a computed property, just this:
<q-icon :name="item.item_type === 'link' ? 'link' : 'double_arrow'" />
👤Fab
1👍
Try adding icon_type
to every item after you fetch data – inside getItensList()
method. You will have list with attached icon to every item.
Source:stackexchange.com