admin管理员组文章数量:1355520
I am a starter at vue and vuetify, explanation and examples would be very nice. I am trying to get a button that sends you to an external site. Example youtube . I now have this, but it is not working.
<v-btn
color="primary"
text
@click="redirect(x.link)"
>
Share
</v-btn>
This is my redirect
methods: {
redirect(link) {
window.location.href = link;
}
}
I saw some other questions using vue-router. I'm not sure how to use that.
I hope its clear what I am asking. Thanks in advance.
I am a starter at vue and vuetify, explanation and examples would be very nice. I am trying to get a button that sends you to an external site. Example youtube. . I now have this, but it is not working.
<v-btn
color="primary"
text
@click="redirect(x.link)"
>
Share
</v-btn>
This is my redirect
methods: {
redirect(link) {
window.location.href = link;
}
}
I saw some other questions using vue-router. I'm not sure how to use that.
I hope its clear what I am asking. Thanks in advance.
Share Improve this question asked Jan 17, 2020 at 16:03 SilkeNLSilkeNL 5621 gold badge8 silver badges30 bronze badges 4- 2 Please check this , maybe can help. Regards! – Ignacio Commented Jan 17, 2020 at 16:08
-
2
it is not working
- Is it a holiday? What do you mean its not working? Did you debug? Does the redirect function get called? Is the link variable actually not null? Did you put a breakpoint or console.log and checked where the problem is? The code shown in the question does not have any problem per se and should work. Edit your question to Include answers to the questions I asked. – Mat J Commented Jan 17, 2020 at 16:09 - I have no clue what I did, but it works. I didn't change anything. I am dumbfounded. Thanks to the both of you! – SilkeNL Commented Jan 17, 2020 at 16:14
-
3
@SilkeNL Try using the
href
orto
prop on thev-btn
and remove the click handler. – Yom T. Commented Jan 17, 2020 at 16:36
1 Answer
Reset to default 8VBtn has a href
prop for this usage.
<v-btn :href="x.link">Share</v-btn>
vue-router
's purpose is to make the routing within your application (in the case of a single page application).
To link to an external web site, you need an href
attribute.
本文标签: javascriptVuetify how to get a working link in a vbtnStack Overflow
版权声明:本文标题:javascript - Vuetify how to get a working link in a v-btn - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743948198a2566797.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论