摘要: 项目出现错误的场景: 前端:react-static 定义 API 之后,在调用 API 时,报错: TypeError:Object(...) is not a function 完整错误如下: 上述错误主要原因是不能识别 .ts 文件,需要安装插件(react-static-plugin-typ 阅读全文
posted @ 2021-04-08 11:35 Freya~ 阅读(270) 评论(0) 推荐(0)
摘要: react-static : https://github.com/react-static/react-static if (typeof window 'undefined') { return; } 阅读全文
posted @ 2021-04-08 11:21 Freya~ 阅读(461) 评论(0) 推荐(0)
摘要: 项目设计到技术: 后端:python/Django 前端:react-static react-static 相关文档: https://github.com/react-static/react-static 本地开发时,可以配置 dev proxy,将 /api/ 转发给需要的那个 django 阅读全文
posted @ 2021-04-08 11:16 Freya~ 阅读(173) 评论(0) 推荐(0)
摘要: 与后端联调时,如果用到 IP 运行项目,只需要修改 package.json 中 start 即可,其他保持不变。 代码如下: "scripts": { "start": "set PORT=3000 HOST=10.10.12.152/ && react-static start", // ⚠️: 阅读全文
posted @ 2021-04-08 11:08 Freya~ 阅读(442) 评论(0) 推荐(0)
摘要: 情景:React项目,在做「下载」功能时,后端返回的数据格式为 Blob 格式,需要在前端调 API 时,对数据进行处理。 以下👇是前端做的处理,希望可以帮到你。 直接贴代码: // 引入 import contentDisposition from 'content-disposition' i 阅读全文
posted @ 2021-04-08 10:45 Freya~ 阅读(2690) 评论(0) 推荐(0)
摘要: 问题:React + fusion.design 中使用 Table,排序功能和锁列功能叠加使用,排序功能不正常:sortIcons 不显示选中状态,偶尔不发排序请求。 去掉 lock: true:排序正常。 加上 lock: true mac chrome:排序正常; mac safari:排序异 阅读全文
posted @ 2021-04-08 10:27 Freya~ 阅读(319) 评论(0) 推荐(0)