前端
前端相关技术
hazelnut_x
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【React】打包时不生成 .map 文件
.map 文件作用及 react 在打包时如何不生成 .map 文件原创 2022-01-16 11:26:53 · 1832 阅读 · 0 评论 -
js fetch 新浪股票接口中文乱码解决方法
乱码问题在 React 中使用 fetch 获取新浪股票接口数据时,出现乱码,代码如下:fetch("/api/list=sz002307", { // 相当于 http://hq.sinajs.cn/list=sz002307 }).then( res => res.text() ).then( data => console.log(data); ) 控制台输出为:var hq_str_sz002307="����·��,4.730, ... 原因分原创 2021-08-30 10:26:34 · 1524 阅读 · 3 评论 -
【React】使用 http-proxy-middleware 解决跨域问题
1. 安装 http-proxy-middlewareyarn add http-proxy-middleware 或 npm i http-proxy-middleware2. 创建 setupProxy.js 文件在 src 中新建一个名为 setupProxy.js 的文件3. 编辑 setupProxy.js 文件const { createProxyMiddleware } = require('http-proxy-middleware');module.exports = f原创 2021-08-29 22:21:55 · 1786 阅读 · 0 评论 -
【前端】 React 安装 与 创建项目
1. 安装 Node,js下载 安装包,按提示安装2. 安装 yarn (可选)全局安装 yarn(v2) :npm install -g yarn按项目安装等其他安装操作可见官方教程3. 安装 Reactnpm install -g create-react-app4. 创建 React 项目create-react-app 项目名5. 启动 React 项目进入项目目录,执行 yarn start 或 npm start启动后效果:6. 安装浏览器插件安装 chro原创 2021-08-29 21:37:29 · 166 阅读 · 0 评论 -
【React】BrowserRouter 与 HashRouter 的不同
底层原理BrowserRouter 使用的是 H5 的 history API ,不兼容 IE9及以下版本HashRouter 使用的是 URL 的哈希值path 表现形式BrowserRouter 路径中没有 #,如 localhost/testHashRouter 路径中有 #,如 localhost/#/test 。 # 后的部分会在前端处理,不会传递给服务器刷新后对路由 state 参数的影响BrowserRouter 没有任何影响,因为 state 会保存在 hist.原创 2021-07-25 21:53:17 · 163 阅读 · 0 评论
分享