前端winter、楊村長、然叔mini-vue手寫實(shí)戰(zhàn)
每個 page 不是默認(rèn)導(dǎo)出一個函數(shù)么?
把 getStaticProps 聲明在這個函數(shù)旁邊即可
栗子??:
export const getStaticProps: GetStaticProps = async () => {
?const posts = await getPosts()
?return {
? ?props: {
? ? ?posts,
? ?}
?}}
必須按照這個格式,不能變(命名和返回值{ props: {...} })
標(biāo)簽: