I am aiming to verify if the link in a json object contains 'http'. If it does, I want to assign a target='_blank' attribute to the v-btn. The link could also be something like #test.
Currently, this is how I am attempting to achieve it:
<v-btn
color="primary"
text
:href="x.link"
x.link.includes("http") ? target="_blank" : null
>
Read more
</v-btn>
However, I encounter this error message pointing to the first double quote after http:
error: Parsing error: unexpected-character-in-attribute-name
This is an example of what x looks like:
0:Object
created_at:null
header:"Sport"
id:1
image_large:"https://i.picsum.photos/id/389/800/400.jpg"
image_medium:"https://i.picsum.photos/id/389/600/300.jpg"
image_small:"https://i.picsum.photos/id/389/200/200.jpg"
link:"http://example.com"
submenu:null
updated_at:null
Some objects have a link like link:"#test"
The issue arises with .includes but I haven't found a solution or workaround yet.
I hope my request is clear. Thank you for your assistance.