欢迎光临散文网 会员登陆 & 注册

前端winter、杨村长、然叔Node进阶实践

2023-03-22 20:23 作者:如歌的trap  | 我要投稿
  • ontext,类型为 NextPageContext

  • context.req / context.res 可以获取请求和响应

  • 一般只需要用到 context.req

  • 栗子🌰:

export const getServerSideProps: GetServerSideProps = async (context) => {  const ua = context.req.headers["user-agent"]  return {    props: {      ua,    }  }}

必须按照这个格式,不能变(命名和返回值{ props: {...} })


前端winter、杨村长、然叔Node进阶实践的评论 (共 条)

分享到微博请遵守国家法律