0

this is my category component

   <tr v-for="(categoryList, index) in getCategoryList" :key="categoryList.id">
          <td>{{index+1}}</td>
          <td>{{categoryList.cat_name}}</td>
          <td>
          <div class="">
          <router-link :to ="'/editCategory/${categoryList.id}'" class="btn btn-sm btn-success"><i class="fa fa-edit"></i></router-link>
          <router-link to="" class="btn btn-sm btn-danger"><i class="fa fa-trash"></i></router-link>
 </div>
</td>
</tr>

may router

import categoryedit from './components/admin/category/edit.vue';
export const routes = [
{
 path: '/editCategory/:categoryId',
 component: categoryedit
}

attach file

enter image description here

how to find category id ?

  • 2
    `:to ="'/editCategory/${categoryList.id}'"` here you need to remove `'`and use ` back tick https://stackoverflow.com/questions/27678052/usage-of-the-backtick-character-in-javascript – Kamlesh Paul Apr 23 '21 at 05:10

1 Answers1

0

Set router-link as:

<router-link :to ="'/editCategory/'+categoryList.id" class="btn btn-sm btn-success"><i class="fa fa-edit"></i></router-link>
shahidiqbal
  • 375
  • 1
  • 7