- 博客(10)
- 收藏
- 关注
原创 路由传参三种方式
state刷新不会丢失,不会出现在url中获取:this.props.location.state传参:this.props.history.push({ pathname: 'path...' ,state:{ … } });query刷新会丢失获取:this.props.location.query传参:this.props.history.push({pathname:'/production',query:{productionId:120,product
2021-09-09 20:06:50
504
原创 ... 展开运算符/剩余运算符
展开运算展开数组const arr = [1,2,3];const arr2 = [4,5,6];const arr3 = [...arr,...arr2,7]; // 合并两数组并添加新值console.log(arr3) //[1,2,3,4,5,6,7]展开对象const o1 = {name : "tom" , age : 18};console.log(...o1); //报错,不能展开对象console.log({...o1}); // {name : "tom" , age
2021-08-31 11:01:33
185
1
原创 npm源切换
查询目前的源npm get registry切换为淘宝镜像源npm config set registry http://registry.npm.taobao.org/切换为原始npm源npm config set registry https://registry.npmjs.org/
2021-07-29 15:36:14
119
原创 elementUI的el-select和el-input中样式无法添加问题解决
// 输入框<el-input class="header-input"></el-input> //选择框<el-select v-model="selectVal" class="selecter"> <el-option v-for="item in options"></el-option></el-select><style> //只有加上::v-deep才能成功添加样式::v-deep .
2021-07-11 18:21:37
795
1
原创 封装柯里化函数(新手也能看懂的)
function Curry(fn,...args){ return (..._atgs)=>{ return fn(...args,..._args) }}function test(a,b,c){ return a *b *c}var t1 = Curry(test ,10);console.log(t1(2,3)) // 60 =10 *2 *3// 首先封装用到了'...'它既是展开运算符,也是剩余运算符,我们来复习一下:var arr = [1,2,3];v
2021-07-08 17:14:04
344
原创 浅谈函数柯里化
函数柯里化:把接受多个参数的函数,变成接受单一参数的函数,然后返回一个函数,余下参数在返回的函数之中// 普通函数function add(x,y,z){ return x + y + z}add(1,2,3)//6// 柯里化函数function add(x){ return function(y,z){ return x + y + z }}add(1)(2,3) //6...
2021-06-30 10:28:37
99
原创 简单封装去抖和节流
去抖// 去抖var Debouncing = (function(){ var t = null; return function(fn , delay){ if(t==null){ t = setTimeout( ()=>{ t = null } , delay) fn() } } })()节流// 节流var Throttling = (function(){ var t = null; return function(fn .
2021-06-23 22:07:38
76
原创 简单理解开发环境和生产环境
一句话概括就是—>项目上线时,会被打包到dist文件里的是生产环境,不会被打包的是开发环境对应的安装指令生产环境: npm i xxx --save 或 npm i xxx -S开发环境: npm i xxx -save-dev 或 npm i xxx -D查看环境中安装了哪些依赖...
2021-06-23 18:30:03
443
原创 解决Vue环境安装问题(详解)
找到一个项目想存放的文件夹创建两个文件夹,分别叫node_global_modules和node_cache在命令行输入指令npm config set prefix “第一个文件夹的路径”npm config set cache “第二个文件夹的路径”执行npm config ls来查看设置的结果设置环境变量>Path>新建 ,写入第一个文件路径修改npm源:npm get registry 获取现在的默认npm源npm config set registry ht.
2021-06-23 12:01:55
352
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人