Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

javascript - 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?

question from:https://stackoverflow.com/questions/65837019/how-to-get-an-absolute-url-hyperlink-path-with-router-link-in-vue

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...