简体   繁体   中英

How to get an absolute URL hyperlink path with router-link in Vue?

When I use the router-link to form a hyperlink in Vue, like as shown below.

<template v-slot:cell(id)="data">
   <router-link :to="`twitter.com/all/status/${data.value}`">{{ data.value }}
   </router-link>
 </template>

It appends the URL to my site, like this.

http://localhost:8080/twitter.com/all/status/1352388073145958402

How can I have an absolute URL path instead?

I solved it by not using router-link at all. Like this.

<template v-slot:cell(id)="data">
    <a :href="`https://twitter.com/all/status/${data.value}`">{{ data.value }}</a>
</template>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM