Skip to content

getStaticPaths 路径返回的值无效。

InvalidGetStaticPathParam:给 getStaticPaths 路径的参数无效。期望 object,得到 PARAM_TYPE

¥InvalidGetStaticPathParam: Invalid params given to getStaticPaths path. Expected an object, got PARAM_TYPE

¥What went wrong?

getStaticPaths 的返回值(对象数组)中的 params 属性也应该是一个对象。

¥The params property in getStaticPaths’s return value (an array of objects) should also be an object.

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

也可以看看:

¥See Also:

Astro 中文网 - 粤ICP备13048890号