【发布时间】:2021-10-28 00:29:48
【问题描述】:
我试图在getServerSideProps 上获取我的页面的路径,但params 的类型是object
我需要做什么才能得到字符串?
export const getServerSideProps: GetServerSideProps = async (context) => {
const { slug } = context.params // Property 'slug' does not exist on type 'ParsedUrlQuery | undefined'.ts(2339)
return {
props: {
},
}
}
【问题讨论】:
标签: javascript typescript next.js