Nuxt JS 中的嵌套动态路由

时间:2021-07-10 20:59:57

标签: vue.js nuxt.js

我目前正在做一个电子商务项目..对于产品页面,我需要这样的网址

http://example.com/products/<category_name>/<product_name>

一切正常,但是每当我尝试使用 <Nuxtlink :to="`/products/${product.get_absolute_url}`"/> 导航到它时,其中 get_absolute_url='/iPhone/iPhone-12-black' 会给出 404 错误,但是当我使用完全相同的 url 刷新页面时,它会显示正确的内容

页面目录:

pages/
--- products/
------ _category/
--------- _product.vue
--------- _index.vue
------ index.vue
--- about.vue
--- index.vue

0 个答案:

没有答案