Vue.js Nuxt.js:`npm run generate`无法生成`index.html`
生成所有静态路由和动态路由,但不生成Vue.js Nuxt.js:`npm run generate`无法生成`index.html`,vue.js,nuxt.js,Vue.js,Nuxt.js,生成所有静态路由和动态路由,但不生成index.html。为什么不呢 在numxt config.js中,我有: const staticRoutes = [ '/about', '/contact', '/portfolio' ] const dynamicRoutes = async () => { const routes = await axios.get('https://my-site.com/wp/wp-json/projects/v1/p
index.html
。为什么不呢
在numxt config.js
中,我有:
const staticRoutes =
[
'/about',
'/contact',
'/portfolio'
]
const dynamicRoutes = async () => {
const routes = await axios.get('https://my-site.com/wp/wp-json/projects/v1/posts')
.then(res => res.data.map((project) => `/project/${project.ID}/${project.post_name}`))
return routes
}
您必须编辑
dynamicRoutes
函数才能在路由中添加索引/
路由:
constdynamicroutes=async()=>{
const routes=等待axios.get('https://fabricepallaud.com/wp/wp-json/projects/v1/posts')
.then(res=>res.data.map((project)=>`/project/${project.ID}/${project.post_name}`)
路线。推送(“/”)
返程路线
}
看