动态嵌套路由nuxt

时间:2020-10-05 18:37:58

标签: vue.js nuxt.js

我正在尝试在nuxt中创建以下结构

image/:slug:用户可以查看图像视图

image/:slug/annotation/:comment-id:用户可以在背景上看到图像,但还会弹出带有评论的弹出窗口

我具有以下文件夹结构:

image
|
| _slug
|  annotation
|    _id.vue
|  index.vue

index.vue上:

<template>
  <section>
    <image-annotation
      :image="activeImage"
      :annotations="activeImageAnnotations"
    />

    <v-divider />
    <title-row />

    <nuxt-child />
  </section>
</template>

我正在阅读docs,但无法实现最终目标

1 个答案:

答案 0 :(得分:0)

解决方案是简单地上移一个级别:

image
|
|  _slug
|    annotation
|      _id.vue
|  _slug.vue