Javascript vue.js中用于导航到动态路线的动态按钮

Javascript vue.js中用于导航到动态路线的动态按钮,javascript,html,node.js,vue.js,vuetify.js,Javascript,Html,Node.js,Vue.js,Vuetify.js,我想通过点击按钮来传递动态路由并获取单个用户信息,我使用的是vuetify,所以我想知道如何在按钮中传递userId,例如这是我的URL :http://localhost:8080/users/userId 例如,如果,我可以从数据库中获取用户ID userId=3984EDeid9dnh3kd9ihttp://localhost:8080/users/3984EDeid9dnh3kd9i 但我不知道如何将它添加到按钮中 这是我的代码: <v-container fluid>

我想通过点击按钮来传递动态路由并获取单个用户信息,我使用的是vuetify,所以我想知道如何在按钮中传递userId,例如这是我的URL :http://localhost:8080/users/userId 例如,如果
,我可以从数据库中获取用户ID userId=3984EDeid9dnh3kd9ihttp://localhost:8080/users/3984EDeid9dnh3kd9i 但我不知道如何将它添加到按钮中

这是我的代码:


 <v-container fluid>
      <v-row class="my-0">
        <v-col
          v-for="(user, userId) in users"
          :key="userId"
          class="col-lg-2 col-md-3 col-sm-4 col-xs-6"
        >
          <template>
            <v-card hover :loading="loading" class="mx-auto" max-width="374">
              <template slot="progress">
                <v-progress-linear
                  color="deep-purple"
                  height="10"
                  indeterminate
                ></v-progress-linear>
              </template>


              <h4 text-right">
                username :
                <span class="font-weight-bold blue--text">
                  {{ user.userName}}
                </span>
              </h4>

              <v-card-actions>
                <v-col>
                  <v-btn
                    text
                    class="float-left"
                    style="text-decoration: none; color: inherit"
                    max-width="50px"
                    :to = HERE IS MY PROBLEM  <===================
                    
                    >More
                  </v-btn>
                </v-col>
              </v-card-actions>
            </v-card>
          </template>
        </v-col>
      </v-row>
    </v-container>
<script>
export default {
  data() {
    return {
//after using axios and get userId
        userId : this.getId
    };
  },



尝试将id连接到路径,如下所示:

 :to ="'/users/'+user.id"


尝试将id连接到路径,如下所示:

 :to ="'/users/'+user.id"


您只需传入字符串对象,它将打开链接

:to="{ name: 'users', params: { userId: userID }}"
代码示例:

<v-btn
      text
      class="float-left"
      style="text-decoration: none; color: inherit"
      max-width="50px"
      :to="{ name: 'users', params: { userId: user.id }}"
      >More
    </v-btn>
更多

您只需传入字符串或对象,它就会打开链接

:to="{ name: 'users', params: { userId: userID }}"
代码示例:

<v-btn
      text
      class="float-left"
      style="text-decoration: none; color: inherit"
      max-width="50px"
      :to="{ name: 'users', params: { userId: user.id }}"
      >More
    </v-btn>
更多