长时间开发最后捡Next.js所以我知道这很可能会归结到一些愚蠢的。 这里去。 什么是错的我 getStaticPaths()
值在这里? 它看起来像我的格式完全相同的文件要求。 (价值被分配到 paths
是 console.log()
'd在终端窗口)
export const getStaticPaths = async () => {
const paths = getEvents();
return {
paths,
fallback: false
};
};
和 getEvents()
功能:
export const getEvents = () => {
axios.post(`${globals.api_endpoint}getEvents.php`, {
action: 'getStaticPaths'
}).then((r) => {
if (!r.data.error) {
const paths = r.data.map(index => {
return {
params: {
id: index.event_id
}
};
});
console.log(paths);
return paths;
}
});
};