LoginSignup
0
1

More than 3 years have passed since last update.

【Nuxt.js】v-data-tableにリンクを埋め込む

Posted at

v-data-table内ではNuxt-linkがうまく機能しなくて困っていましたが、
v-btnに「:to=」でリンクを仕込めました。
アイコン型のリンクする場合、v-btnの中にv-iconを組み込む。

<v-data-table
 :headers="headers"
 :items="指定したいテーブル"
  item-key="id"
>
  <template v-slot:[`item.actions`]="{ item }">
    <v-btn
      icon
      :to="'/任意のリンク' + item.id"
      nuxt    
     >
      <v-icon dark>
        mdi-pencil
       </v-icon>
    </v-btn>
  </template>
</v-data-table>

image.png

◆header部

headers() {
        return [ 
      ※他の項目は省略しています
             {
            text: '操作',
            value: 'actions',
            sortable:false,
             }
          ]}

◆バージョン情報
 "nuxt": "^2.0.0"
 "vue": "^2.6.12"
 "@nuxtjs/vuetify": "^1.11.2"

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1