I'm trying to make URLs in a text clickable using Nuxt/Vue.
The input text is:
Learning Outside the Box - https://learningoutsidethebox.com
I have a method that converts it to a link:
setLinks(text) {
var Rexp = /(\b(https?|ftp|file):\/\/([-A-Z0-9+&@#%?=~_|!:,.;]*)([-A-Z0-9+&@#%?\/=~_|!:,.;]*)[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(Rexp, "<NuxtLink to='$1' target='_blank'>$1</NuxtLink>");
}
After that I get a result: Learning Outside the Box - <NuxtLink to='https://learningoutsidethebox.com' target='_blank'>https://learningoutsidethebox.com</NuxtLink>
. But it is still not clickable.
Changing to <a>
didn't solve the problem.
Could you please clarify, what should I do to make this text become a working link?