Vue.js 如何将nuxt.js路由器更改为使用自定义路径?
对于软件开发营销网站,我有30多个登录页,我喜欢将它们保存在Vue.js 如何将nuxt.js路由器更改为使用自定义路径?,vue.js,nuxt.js,Vue.js,Nuxt.js,对于软件开发营销网站,我有30多个登录页,我喜欢将它们保存在/pages/landing文件夹中。因此,显然/pages/landing中的文件可以通过访问,例如: www.lorem.com/landing/python-development-experts/ www.lorem.com/landing/java-development-experts/ 但是我需要从路径中删除/landing/,并且仍然希望将文件保存在/pages/landing文件夹中,但需要使用以下路径访问文件: w
/pages/landing
文件夹中。因此,显然/pages/landing
中的文件可以通过访问,例如:
www.lorem.com/landing/python-development-experts/
www.lorem.com/landing/java-development-experts/
但是我需要从路径中删除/landing/
,并且仍然希望将文件保存在/pages/landing
文件夹中,但需要使用以下路径访问文件:
www.lorem.com/python-development-experts/
www.lorem.com/java-development-experts/
请帮助,谢谢。您可以通过此链接扩展您的路线 也许有帮助!
谢谢 以下是我在
numxt.config.js中所做的
router: {
extendRoutes: (routesIn) => {
routesIn.forEach((r) => {
if (r.path.includes('/landing/')) {
r.path = r.path.replace('/landing', '');
}
});
return routesIn;
},
},
看起来这可能是一个很好的解决方案。今天早上我试着在routes上玩,但似乎没有别的办法。