18
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Nuxt.jsで動的な値を利用してリンクを作成する

Posted at

環境

Nuxt.js 2.7.1

フォルダ構成

pages/
--| users/
-----| _id.vue
-----| index.vue

実装

pathではなくnameを利用

<nuxt-link :to="{ name: 'users-id', params: { id: id } }">{{ userName }}</nuxt-link>

ルーティングの確認

自動生成された動的ルーティングを確認したい場合は.nuxt/router.jsを確認

router.js
    routes: [{
      path: "/users/:id",
      component: _ae4a17c4,
      name: "users-id"
    }]

参考

ルーティング - Nuxt.js

18
13
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
18
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?