“ : ” 开头的路由,用于截获这段路由层级的字符串并生成对应名称的对象,例如

/post/:postId

// 用户访问
/post/0000xxx1

// result
{ postId: "0000xxx1" }

要在 Next 使用动态路由,可以在创建文件时,将文件名包裹在中括号中 [filename]

Untitled

然后在组件中通过 props - params 获取

const page: React.FC<Props> = ({ params: { is } }) => {
	return (
		<div>{id}</div>
	)
}