Skip to content

getStaticPaths 返回的值无效。

InvalidGetStaticPathsReturn:getStaticPaths 返回的类型无效。期望 array,得到 RETURN_TYPE

¥InvalidGetStaticPathsReturn: Invalid type returned by getStaticPaths. Expected an array, got RETURN_TYPE

¥What went wrong?

getStaticPaths 的返回值必须是一个对象数组。

¥getStaticPaths’s return value must be an array of objects.

pages/blog/[id].astro
export async function getStaticPaths() {
return [ // <-- Array
{ params: { slug: "blog" } },
{ params: { slug: "about" } }
];
}

也可以看看:

¥See Also:

Astro 中文网 - 粤ICP备13048890号