具有两个级别的 NUXTJS 中的动态路由

Dynamic Routes in NUXTJS with two levels

我想在我的应用程序 NuxtJS 中配置一个路由。这是一个简单的问题。这是我的页面结构:

pages/
--| customers/
-----| _id.vue
--| studies/
-----| _id.vue
-----| Configuration.vue

我有一个包含此路径的页面:myapp。com/studies/3

我想设置这样的路径:myapp.com/studies/3/configuration.

现在这个结构是:myapp.com/studies/configuration

我该怎么做?

谢谢

您可以通过将 _id.vue 文件更改为文件夹并创建索引和配置 vue 文件来实现。就这样...

 pages/
--| customers/
-----| _id.vue
--| studies/
-----| _id/
--------| index.vue
--------| configuration.vue

现在如果你访问

  1. yourapp.com/studies/3 您将获得 index.vue 页面
  2. yourapp.com/studies/3/configuration 您将获得 configuration.vue 页面

有什么不明白的可以问我