I have the following data
"meta": {
"total_count": 17
},
"items": [
{
"id": 80,
"meta": {
"type": "",
"detail_url": "",
"html_url": "",
"slug": "",
"first_published_at": ""
},
"title": "some title",
"image": {
"id": 46,
"meta": {
"type": "wagtailimages.Image",
"detail_url": "some url",
"download_url": "/media/original_images/im.png"
},
"title": "im.png",
"width": 100,
"height": 80
},
}
]
Now if I try to get the width of an image inside :src attribute it works but if I try to pass it to a method it doesn't , a snippet of the HTML code is:
<li v-for="(item, index) in response_data">
<a v-bind:href="item.meta.html_url">
<div class="icon" :class="classObject(item.image.width,item.image.height)">
<img v-if="item.image" v-bind:src="item.image.meta.download_url" alt=""/>
<img v-else src="{% static 'images/logo-dummy.svg' %}" alt="logo-dummy.svg"/>
</div>
where classObject is a method that compares the width and the height, I tried also to make it a computed property, the above code doesn't work but if for example I wrote
<img v-if="item.image" v-bind:src="item.image.width">
I can see the width inside the src attribute, what am I doing wrong?
Edit: classObject code is the following
classObject: function (width, height) {
if (width > height) return 'icon1'
return 'icon2'
},
classObjectlook like? How do you know it's not working?