type
Post
status
Published
date
Feb 1, 2024
slug
nextjs-difficult
summary
tags
开发
推荐
必看精选
热门文章
category
技术分享
icon
password
1、api路由拦截
在根目录添加 middleware.js
2、页面路由拦截
在next.config.js 文件中添加
3、开发、生产启动端口指定
全部指定为9999
4、使用fetch上传文件,Content-Type指定为From表单,上传失败
解决办法:去除content-type指定即可
5、next build 打包后mysql报错:MySQL Error: Received packet in the wrong sequence.
6、next.js 引用Ant Design Pro Components报错
ProLayout - 高级布局:ProLayout - 高级布局 - ProComponents (ant.design)
引用方法改为:
7、模拟接口请求提示AxiosError: Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream
直接上错误代码:
乍一看没问题,细一看也没问题,问题在于这是NodeJs环境,使用FormData需要引入
form-data依赖。8、允许跨域请求
直接上代码:
