摘要: //安装less less less-loader npm install less less-loader --save-dev 安装完成后,在项目中的config目录下找到webpack.config.js文件(说明:新建项目一般默认不显示config目录的,需要执行npm run eject) 阅读全文
posted @ 2020-04-15 14:49 KG-work-space 阅读(521) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html" /> <meta name="keywords" content="不用临时变量进行两个值 阅读全文
posted @ 2020-04-14 16:47 KG-work-space 阅读(492) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html" /> <meta name="keywords" content="数组转换成前端更容易解析的树状结构" /> <meta name=" 阅读全文
posted @ 2020-04-13 22:00 KG-work-space 阅读(268) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html"/> <meta name="keywords" content="二分查找算法" /> <meta name="description" 阅读全文
posted @ 2020-04-13 13:22 KG-work-space 阅读(148) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html" /> <meta name="keywords" content="统计一个字符串出现最多 阅读全文
posted @ 2020-04-10 17:41 KG-work-space 阅读(369) 评论(0) 推荐(0)
摘要: 效果图: import React, { Component } from 'react'; import scaleImage from './images/scale.png'; import closeImage from './images/close.png'; import maskIm 阅读全文
posted @ 2020-04-09 17:05 KG-work-space 阅读(1208) 评论(0) 推荐(0)
摘要: 下图是diff算法结构的详细解析: 要点总结:DIFF算法在执行时有三个维度,分别是Tree DIFF、Component DIFF和Element DIFF,执行时按顺序依次执行,它们的差异仅仅因为DIFF粒度不同、执行先后顺序不同。 下图详解: Tree DIFF是对树的每一层进行遍历,如果某组 阅读全文
posted @ 2020-04-08 15:38 KG-work-space 阅读(526) 评论(0) 推荐(0)
摘要: 含义:假设B复制了A,当修改A时,看B是否会发生变化,如果B也跟着变了,说明这是浅拷贝,如果B没变,那就是深拷贝。 关于栈堆,就要了解基本数据类型与引用数据类型,因为这些概念能更好的让你理解深拷贝与浅拷贝 let a=[0,1,2,3,4], b=a; console.log(a b); //tru 阅读全文
posted @ 2020-03-30 20:02 KG-work-space 阅读(282) 评论(0) 推荐(0)
摘要: withRouter的作用:把不是通过路由切换过来的组件,将react-router的history、location和match三个对象传入到props对象上; 默认情况下必须是经过路由匹配渲染的组件才存在this.props,才拥有路由参数,才能使用编程式导航的写法,执行this.props.h 阅读全文
posted @ 2020-03-25 15:34 KG-work-space 阅读(405) 评论(0) 推荐(0)
摘要: 1.什么是Component,PureComponent? 都是class方式定义的基类,两者没有什么大的区别,只是PureComponent内部使用shouldComponentUpdate(nextProps,nextState)方法,通过浅比较(比较一层),来判断是否需要重新render()函 阅读全文
posted @ 2020-03-24 20:18 KG-work-space 阅读(376) 评论(0) 推荐(0)