摘要: 前端spa项目,使用 browserHistory 刷新后页面错误 node 服务器设置 app.use(function(err, req, res, next) { // set locals, only providing error in development res.locals.mes 阅读全文
posted @ 2021-04-01 17:18 anin 阅读(463) 评论(0) 推荐(0) 编辑
摘要: 本地开发手机移动端调试时发现其他浏览器能正常打开网页,但是使用uc浏览器时页面一片空白,排查后发现是手机免流设置的问题,使用阿里系的免流卡时,uc浏览器会走网络流量而不是本地的服务器, 解决方法,把免流开关关掉就好了。 ps:吐槽一下这么多年了uc浏览器对es6兼容性还这么差, 阅读全文
posted @ 2021-01-20 16:30 anin 阅读(1396) 评论(0) 推荐(0) 编辑
摘要: 部分手机flex布局下对justify-content: space-evenly;属性兼容性不够好, 解决方法 flex-box{ display: flex; flex-flow: row nowrap; align-items: center; justify-content: space-b 阅读全文
posted @ 2021-01-08 09:44 anin 阅读(782) 评论(0) 推荐(0) 编辑
摘要: 在开发环境下样式没有问题,打包到生产环境发现样式不生效 可能的原因 1.dist文件夹下未生成css样式文件。 webpack4中tree-shaking会默认移除 JavaScript 上下文中的未引用的代码,用来达到减轻重量的思想,tree-shaking通过 package.json 的 "s 阅读全文
posted @ 2020-09-03 14:24 anin 阅读(1703) 评论(0) 推荐(0) 编辑
摘要: redux处理异步状态管理请求 npm i redux-thunk -S import {createStore,applyMiddleware,combineReducers,compose} from "redux" import thunk from "redux-thunk" //中间件,用 阅读全文
posted @ 2020-08-29 15:34 anin 阅读(450) 评论(0) 推荐(0) 编辑
摘要: Redux DevTools需要主动配置才可以在浏览器内查看状态 import {createStore,applyMiddleware,combineReducers,compose} from "redux" import thunk from "redux-thunk" //中间件,用来处理异 阅读全文
posted @ 2020-08-29 15:19 anin 阅读(315) 评论(0) 推荐(1) 编辑
摘要: flex-grow属性在文本过长时会超出父窗体长度, 添加 width:0; 可解决。 阅读全文
posted @ 2020-08-26 21:30 anin 阅读(351) 评论(0) 推荐(0) 编辑
摘要: 方案1 //配置: package.json"proxy":"https://xxxx.com" 问题: 只能代理一个服务器 方案二 利用客户端代理中间件(http-proxy-middleware)完成, 官网给了新的使用方式,在src下新建文件setupProxy.js加下面代码, 无需单独应用 阅读全文
posted @ 2020-08-25 12:24 anin 阅读(6792) 评论(0) 推荐(0) 编辑
摘要: 直接修改this.state数据不会响应式更新页面, 需要使用setState方法,而且setState是可能异步的(由 React 控制的事件处理过程 setState 不会同步更新 this.state), 一般有两种调用方式 //修改 this.setState(对象) //浅合并state 阅读全文
posted @ 2020-08-19 16:24 anin 阅读(568) 评论(0) 推荐(0) 编辑
摘要: react在事件监听时可能会导致this指向丢失,以下几种方式可以修正这个问题 1.嵌套箭头函数 <button onClick={(e)=>this.fn1(e)}>按钮fn1</button> 箭头函数可以修正fn1函数内部的this指向,但如使用事件对象的话需要显式传递事件对象参数 2.监听的 阅读全文
posted @ 2020-08-19 15:08 anin 阅读(533) 评论(0) 推荐(0) 编辑