摘要: ::-webkit-scrollbar { width: 7px; height: 7px; background-color: #0000001a; } ::-webkit-scrollbar-track { background-color: #0000001a; } ::-webkit-scr 阅读全文
posted @ 2023-03-03 09:57 抽风的皮鞭 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 当前端收到后端传过来的数据流时,前端文件下载方法: let url = window.URL.createObjectURL(new Blob([res.body])); let link = document.createElement('a'); link.style.display = 'no 阅读全文
posted @ 2023-02-28 09:21 抽风的皮鞭 阅读(116) 评论(0) 推荐(0) 编辑
摘要: react中属性的命名方式都是小驼峰(如:className、onClick) 1. 数据绑定 react中的数据绑定是使用大括号{} <div className="content">{aa}</div> // 函数式组件 <div className="content">{this.state. 阅读全文
posted @ 2023-02-20 11:27 抽风的皮鞭 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 目前react官网已经不建议下载create-react-app脚手架到本地的方式来搭建项目了,我们可以直接用npx的方式来快速搭建react项目。我本地用的node版本是18.xxx的,如果是低版本的node和npm的话执行命令会失败(我之前用的node版本是14.xxx的,创建项目一直失败,试了 阅读全文
posted @ 2022-12-12 16:20 抽风的皮鞭 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1. 根目录下新建proxy.conf.json文件 { "/api/*": { "target": "http://localhost:4200", "secure": false, "changeOrigin": true, "pathRewrite": { "^/api": "" // 将请求 阅读全文
posted @ 2022-12-12 15:30 抽风的皮鞭 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 当我们react项目中使用a标签但是没加href属性时,会看到如下警告: The href attribute is required for an anchor to be keyboard accessible. Provide a valid,navigable address as the 阅读全文
posted @ 2022-12-09 16:49 抽风的皮鞭 阅读(552) 评论(0) 推荐(0) 编辑
摘要: 我们node项目中cache和cookie中保存中文时不能直接保存,要用base64加密来保存。当我们项目中在浏览器端通过http请求到这些加密字符串进行解密展示时会出现部分乱码,原因是接收到数据后浏览器会先对加密字符串做一层加密,会改变部分字符,造成正常解析失败,解决方法是: import { B 阅读全文
posted @ 2022-12-09 16:01 抽风的皮鞭 阅读(689) 评论(0) 推荐(0) 编辑
摘要: 本地node升级成18.x版本后,启动原先的项目会出现报错:digital envelope routines::unsupported 通过查找原因,这是由于node 17的bug,解决方法如下: 修改package.js,在相关构建命令之前加入set NODE_OPTIONS openssl-l 阅读全文
posted @ 2022-12-08 17:46 抽风的皮鞭 阅读(870) 评论(0) 推荐(0) 编辑
摘要: react路由模块react-router-dom的6.x版本较老版本有较大改动,具体用法如下: 1. 下载react-router-dom npm i react-router-dom --save 2.在入口文件引入BrowserRouter包裹App根组件 index.js import Re 阅读全文
posted @ 2022-12-08 17:28 抽风的皮鞭 阅读(1317) 评论(0) 推荐(0) 编辑
摘要: package.json { "scripts": { "start": "set PORT=4400 && react-scripts start", // 注意修改端口号要写在前面 "build": "react-scripts build", "test": "react-scripts te 阅读全文
posted @ 2022-12-08 10:58 抽风的皮鞭 阅读(410) 评论(0) 推荐(0) 编辑