07 2020 档案

摘要:react路由懒加载(异步组件) react-loadable(以路由组件分割代码) 或者参考 https://www.cnblogs.com/SRH151219/p/11207919.html 安装 cnpm install react-loadable -S 如果项目有100个页面,那laoda 阅读全文
posted @ 2020-07-31 11:22 小魏code 阅读(889) 评论(0) 推荐(0)
摘要:我们一直在使用的路由方式是BrowserRouter,也就是浏览器的路由方式,其实React还有几种路由方式: 1、BrowserRouter:浏览器的路由方式,也就是在开发中最常使用的路由方式 2、HashRouter:在路径前加入#号成为一个哈希值,Hash模式的好处是,再也不会因为我们刷新而找 阅读全文
posted @ 2020-07-30 20:08 小魏code 阅读(1150) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/tiangongkaiwu152368/article/details/80854683 阅读全文
posted @ 2020-07-30 19:45 小魏code 阅读(642) 评论(0) 推荐(0)
摘要:let Base64 = { encode(str) { // first we use encodeURIComponent to get percent-encoded UTF-8, // then we convert the percent encodings into raw bytes 阅读全文
posted @ 2020-07-29 16:02 小魏code 阅读(6443) 评论(0) 推荐(1)
摘要:npm install --save base-64 在react中中引入依赖 import Base64 from 'base-64'; 使用 Base64.encode(this.pwd);//加密 Base64.decode(this.pwd);//解密 阅读全文
posted @ 2020-07-29 10:09 小魏code 阅读(5410) 评论(0) 推荐(0)
摘要:linear,swing,jswing,easeInQuad,easeOutQuad,easeInOutQuad,easeInCubic,easeOutCubic,easeInOutCubic,easeInQuart,easeOutQuart,easeInOutQuart,easeInQuint,e 阅读全文
posted @ 2020-07-27 18:38 小魏code 阅读(250) 评论(0) 推荐(0)
摘要:https://segmentfault.com/a/1190000022522154 阅读全文
posted @ 2020-07-26 12:19 小魏code 阅读(2084) 评论(0) 推荐(0)
摘要:转载 https://www.cnblogs.com/plBlog/p/12355735.html 官网: https://react.docschina.org/docs/higher-order-components.html 更快助你弄懂React-高阶组件 https://segmentfa 阅读全文
posted @ 2020-07-26 11:21 小魏code 阅读(113) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/jianxian/p/12518258.html 阅读全文
posted @ 2020-07-23 10:51 小魏code 阅读(185) 评论(0) 推荐(0)
摘要:路由组件中 使用 BrowserRouter 即可 或者 参考 转载 https://blog.csdn.net/weixin_42727360/article/details/84105654 或 https://segmentfault.com/q/1010000013636383 阅读全文
posted @ 2020-07-23 10:05 小魏code 阅读(2724) 评论(0) 推荐(0)
摘要:this.program = this.program.replace(/(^\s*)|(\s*$)/g, ''); //去除空格; console.log('此刻的方案:',this.program) if (this.program == '' || this.program == undefi 阅读全文
posted @ 2020-07-22 19:56 小魏code 阅读(5386) 评论(0) 推荐(0)
摘要:https://segmentfault.com/a/1190000007062464?utm_source=sf-related 阅读全文
posted @ 2020-07-22 17:14 小魏code 阅读(175) 评论(0) 推荐(0)
摘要:有时候,出于某种目的,需要将数组转化成对象,一个简单快速的方法是就使用展开运算符号(...): var fruits = [“banana”, “apple”, “orange”, “watermelon”]; var fruitsObj = { …fruits }; console.log(fru 阅读全文
posted @ 2020-07-21 17:28 小魏code 阅读(930) 评论(0) 推荐(0)
摘要:在写react组件的时候,会有这个警告 Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. 阅读全文
posted @ 2020-07-20 19:42 小魏code 阅读(3036) 评论(0) 推荐(0)
摘要:import React,{Component } from 'react' import './App.css'; class App extends Component{ scrollToBottom() { if (this.messagesEnd) { const scrollHeight 阅读全文
posted @ 2020-07-20 18:47 小魏code 阅读(3542) 评论(0) 推荐(0)
摘要:定义全局变量timer。 this.state = { timer: null, }; // 组件加载完毕 启动定时器 componentDidMount(){ setTimeout(this.iTimer,0); } // 定时器 iTimer = () => { this.setState({ 阅读全文
posted @ 2020-07-20 18:25 小魏code 阅读(4289) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/SCU_Cindy/article/details/82778031 阅读全文
posted @ 2020-07-20 18:20 小魏code 阅读(171) 评论(0) 推荐(0)
摘要://换行white-space:normal;word-break:break-all;word-wrap: break-word; 相关属性white-space: normal|pre|nowrap|pre-wrap|pre-line|inherit; white-space 属性设置如何处理元 阅读全文
posted @ 2020-07-20 17:12 小魏code 阅读(2280) 评论(0) 推荐(0)
摘要:div 加滚动条bai的方法:<div style="position:absolute; height:400px; overflow:auto"></div>div 设置滚动条显示du:overflow :yesdiv 设置滚动条自适应zhi显示:overflow :autodiv 设置上下滚动 阅读全文
posted @ 2020-07-20 17:10 小魏code 阅读(1102) 评论(0) 推荐(0)
摘要:CSS代码生成器 CSS3 Generator 终极CSS Generator CSS Grid布局生成器 静态站点生成器 Next.js Gatsby SVG 优化器 SVGOMG SVG Optimizers 动画库 Animate.css GreenSock (GSAP) Anime.js 跨 阅读全文
posted @ 2020-07-17 10:01 小魏code 阅读(123) 评论(0) 推荐(0)
摘要:https://www.jianshu.com/p/6697415d09d8 虽然用ui框架有很多是有轮播图,走马灯的,但是有时候我们的需求是这些都无法满足的, 在这里我这个菜鸟遇到了要求图文列表可以左右滑动的情况,找了很久还是swiper适合我 下面展示一下我的用法: 首先,react项目中安装s 阅读全文
posted @ 2020-07-16 15:30 小魏code 阅读(3927) 评论(0) 推荐(0)
摘要:https://github.com/kamranahmedse/developer-roadmap/tree/master/translations/chinese 阅读全文
posted @ 2020-07-16 10:38 小魏code 阅读(176) 评论(0) 推荐(0)
摘要:自从使用 Vue2 之后,就使用官方推荐的 axios 的插件来调用 API,在使用过程中,如果服务器或者网络不稳定掉包了, 你们该如何处理呢? 下面我给你们分享一下我的经历。 具体原因 最近公司在做一个项目, 服务端数据接口用的是 Php 输出的 API, 有时候在调用的过程中会失败, 在谷歌浏览 阅读全文
posted @ 2020-07-16 09:47 小魏code 阅读(5641) 评论(0) 推荐(1)
摘要:https://blog.csdn.net/qq_41887214/article/details/105752554 阅读全文
posted @ 2020-07-15 14:58 小魏code 阅读(799) 评论(0) 推荐(0)
摘要:数据交互有两种模式:Push(推模式)、Pull(拉模式)。 1 推模式指的是客户端与服务端建立好网络长连接,服务方有相关数据,直接通过长连接通道推送到客户端。 <1>优点:及时,一旦有数据变更,客户端立马能感知到;另外对客户端来说逻辑简单,不需要关心有无数据这些逻辑处理。 <2>缺点:不知道客户端 阅读全文
posted @ 2020-07-15 10:40 小魏code 阅读(355) 评论(0) 推荐(0)
摘要:http://cloud.yundashi168.com/archives/397 阅读全文
posted @ 2020-07-14 11:12 小魏code 阅读(209) 评论(0) 推荐(0)
摘要:https://segmentfault.com/a/1190000017361781?utm_source=tag-newest 阅读全文
posted @ 2020-07-14 10:49 小魏code 阅读(1052) 评论(0) 推荐(0)
摘要:由于数据传输的原因,有时我们得到的是字符串形式的数组(比如:str='["a","b","c","d"]',写成str="['a', 'b', 'c', 'd']",使用JSON.parse()的时候会报错)。要将这种字符串还原成数组对象,有如下两种方法。 1,使用 eval() 函数转换 (1)e 阅读全文
posted @ 2020-07-10 17:51 小魏code 阅读(4468) 评论(0) 推荐(0)
摘要:报错:Cannot read property 'map' of undefine <ul className={styles.resul}> { this.state.isfalsepic.map((item) => { return ( <li className={styles.resli} 阅读全文
posted @ 2020-07-10 16:30 小魏code 阅读(8072) 评论(0) 推荐(0)
摘要:import {withRouter} from 'react-router-dom'; 并切在导出时候用这个方法包裹住 export default connect(function (state, props){ return state; }, { addItem(item){ return 阅读全文
posted @ 2020-07-06 18:50 小魏code 阅读(3040) 评论(0) 推荐(0)
摘要:首先知道 CSS具有两大特性:继承性,层叠性 使用 “@extend” 来继承一个样式块,从而实现代码的重用。 .spriteAll { bakckground:url(images/sprite.png) no-repeat; } .sprite-1 { @extend .spriteAll; b 阅读全文
posted @ 2020-07-06 17:28 小魏code 阅读(208) 评论(0) 推荐(0)
摘要:虽然只是一个简单的功能,还是记录一下比较好。页面上有很多个li,要实现点击到哪个就哪个高亮。当年用jq的时候,也挺简单的,就是选中的元素给addClass,然后它的兄弟元素removeClass,再写个active的样式就搞定了。那现在用react要实现类似的操作,我想到的就是用一个currentI 阅读全文
posted @ 2020-07-06 17:01 小魏code 阅读(3012) 评论(0) 推荐(0)
摘要:React控制元素显示和隐藏的方法目前我知道的有三种方法:第一种是通过state变量来控制是否渲染元素,类似vue中的v-if。第二种是通过style控制display属性,类似vue 中的v-show。第三种是通过动态切换className。 第一种方法是通过此例中showElem变量来控制是否加 阅读全文
posted @ 2020-07-03 10:31 小魏code 阅读(5503) 评论(0) 推荐(0)
摘要:<Button className={placeTime.length > 1 ? styles.delBtn : styles.delFirst} onClick={this.onRemove (index)}> <Icon type={'delete'}/>删除 </Button> ) onRe 阅读全文
posted @ 2020-07-02 16:22 小魏code 阅读(7749) 评论(0) 推荐(0)
摘要:<body> <input type="file" id="file" style="display: none;"> <button id="btn">upload</button></body><script> let btn = document.querySelector('#btn') l 阅读全文
posted @ 2020-07-02 11:35 小魏code 阅读(228) 评论(0) 推荐(0)
摘要:<body> <input type="file" id="file" style="display: none;"> <button id="btn">upload</button></body><script> let btn = document.querySelector('#btn') l 阅读全文
posted @ 2020-07-02 11:34 小魏code 阅读(1139) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/chifung/p/11763147.html 阅读全文
posted @ 2020-07-01 11:03 小魏code 阅读(1581) 评论(1) 推荐(0)