Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify: create image that links to another page

I'm trying to make an image link in my vue app. I've tried the following but it doesn't work:

<v-img :src="require('@/assets/my-image.png')" to="/"></v-img>

I've also tried wrapping the image in a router-link element but no luck:

<router-link to="/">
    <v-img :src="require('@/assets/my-image.png')"></v-img>
</router-link>

Any idea what I'm doing wrong. This shouldn't be that difficult.

like image 585
Johnny Metz Avatar asked Apr 21 '19 03:04

Johnny Metz


2 Answers

Try this (src vs :src):

<router-link to="/">
    <v-img src="require('@/assets/my-image.png')"></v-img>
</router-link>
like image 187
Ruslan Isay Avatar answered Oct 08 '22 11:10

Ruslan Isay


i use some like this, and it works.

<a href="/">
 <v-img :src="require('@/assets/logo.png')"
 max-width="60"
 to="/afiliacion"
 width="100%">  </v-img> 
</a>
like image 1
user14834726 Avatar answered Oct 08 '22 09:10

user14834726