I have post.text data containing the text of a blog post submitted by a user. Like Twitter, users can specify other users using sintax I am tagging @user1 in this post . When rendering a message, I want to replace all instances of @username links to the specified userβs page.
With regex match / replace, I can easily convert the mentioned @username into something like (I use vue-router):
I am tagging <router-link :to="{name: 'user', params: {userId: post.userId}}">{{ dPost.user_name }}</router-link> in this post
But when I use it like this:
<p v-html="preparedText"></p>
vue does not process html to bind its own tags.
How to solve this problem? Thanks
source share