我正在尝试找出如何在带有 i18n 模块的 Nuxt.js 上将同一页面用于多个路由。
基本上我想要这条路线:/product-category/:slug/in/:material
使用相同的页面/product-category/:slug
到目前为止,我已经在下面尝试过,将其添加到 nuxt.config.js - 但它不起作用。它只是显示_slug/_material/index.vue
文件。
router: {
extendRoutes (routes, resolve) {
routes.push({
path: '/product-category/:slug/in/:material',
component: resolve(__dirname, 'pages/product-category/_slug/index.vue')
})
}
},
也许是因为我有 i18n 模块,也许是因为我做错了什么。
这是我的文件夹结构:
如果我检查我的 router.js 文件,我会看到两次显示的路径: