'Create Inertia Link inside vue method

I need to generate an Intertia Link based on different conditions.

I have the following code in my template:

<td v-html="buildLink(data)"></td>

And the following code in the method section:

methods: {
 buildLink(data) {
    // Some logic here
       -----
    // And then Finally need to return the URL as intertia link
    return '<Link href="route(routeName)">data.title</Link>';    
 },
}

The output it produces is following

 <td data-v-5bd01d73="">
   <link href="http://project.test/dashboard">Home
 </td>

As you can see the above code does not generate the Inertia JS anchor tag. I know I could get the desired result using conditional rendering in the template section, but I am looking for a solution to generate the link inside the method.

Is there any solution?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source