【问题标题】:Folders/files structure for nuxt Dynamic routesnuxt 动态路由的文件夹/文件结构
【发布时间】:2021-02-23 10:45:04
【问题描述】:

文件和文件夹的结构应该如何使 url 像这样:localhost:3000/apps/10/ads/12 10 和 12 是所选应用和所选广告的 id。

到目前为止,我得到了下面的文件夹结构:

localhost:3000/apps/10/

我应该如何编辑文件夹结构以使整个 url 正常工作?

文件夹结构:

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

【问题讨论】:

    标签: nuxt.js vue-router


    【解决方案1】:

    您也必须为文件夹使用“_id”架构名称。

    例如。 _app & _ad:

    pages/
    ---|apps/
    -----|index.vue
    -----|_app/
    -------|index.vue     # localhost:3000/apps/10
    -------|ads/
    ---------|_ad.vue     # localhost:3000/apps/10/ads/12
    

    ...
    -------|ads/
    ---------|_ad/
    -----------index.vue  # localhost:3000/apps/10/ads/12
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-04
      • 1970-01-01
      • 2020-11-19
      • 2012-10-13
      • 2021-05-05
      • 1970-01-01
      • 2020-11-05
      • 1970-01-01
      相关资源
      最近更新 更多