[Vuejs]-Links overlay in v-bind:href

0👍

I finally used Vue methods to solve the problem.

Let <a></a> listen click event, and pass myCase.id to the methods.

<td>
   <a href="" @click.prevent="goLink(myCase.id)" class='btn btn-danger'>Go to link</a>
</td>

Vue methods:

 goLink(id) {
   let removeLink = window.location.href;  // get current link's text
   let repeatWord = removeLink.search('open/detail');  // check if there is repeat words 
   if (repeatWord > 0) {
      location.href = `../${id}`;  // other condition
   } else {
      location.href = `../open/detail/${id}`;  // first time click
   }
 },

Leave a comment