2020年12月31日星期四

v-slot in b-table getting scope to data

Im using a v-slot in a b-table so I can create a link.

The first part of the link contains data from the datasource. However the querystring has a parameter that I need to include in the link. How can I get scope to my data that holds the querystring value so I can add the querystring to the link in my v-slot?

Thank you in advance, Marty

<template>      <div>          <h1>View Users</h1>          Select a user to edit            <b-table striped :items="users">              <template v-slot:cell(id)="data">                  <a :href="'/#/admin/user?userId=' + data.value + '&companyId=' + ##HERE## "></a>              </template>          </b-table>          </div>  </template>    <script>              export default {          data() {              return {                  users: [],                  companyId : ""              }          },          methods: {              getUsers() {                  var self = this;                    self.$client.get('/api/Admin/GetUsers?companyId=' + this.$route.query.companyId).then(response => {                      self._data.users = response.data;                  });              }          },          mounted() {                this.companyId = this.$route.query.companyId              this.getUsers();          }          }  </script>  
https://stackoverflow.com/questions/65526173/v-slot-in-b-table-getting-scope-to-data January 01, 2021 at 07:08AM

没有评论:

发表评论