nuxt项目如何在路由地址上添加.html后缀?
export default { // ... router: { extendRoutes(routes, resolve) { routes.push({ name: 'test-id-html', path: '/test/:id.html', component: resolve(__dirname, 'test/_id.vue') }); routes.push({ name: 'test-html', path: '/test.html', component: resolve(__dirname, 'test/_id.vue') }); } } // ... }
nuxt.config.js ... router: { extendRoutes(routes, resolve) { routes.push({ name: "newsHtml", path: "/news/:id.html", component: resolve(__dirname, "src/pages/news/id.vue") }); } },