![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔记
Jay_帅小伙
这个作者很懒,什么都没留下…
展开
-
mongodb安装服务,删除与安装
删除mongod --logpath “D:\MongoDB\mongodb\logs\mongo.log” --logappend --dbpath “D:\MongoDB\mongodb\data\db” --directoryperdb --serviceName “MongoDB” --serviceDisplayName “MongoDB” --remove安装mongod --logpath “D:\MongoDB\mongodb\logs\mongo.log” --logappend -原创 2020-06-20 13:44:13 · 160 阅读 · 0 评论 -
2021-02-25
有没有工作推荐原创 2021-02-25 14:01:23 · 67 阅读 · 0 评论 -
复制数组,不改变指针
// 复制数组,不改变指针// ES5const a1 = [1,2]const a2 = a1.concat()// ES6const a1 = [1,2]const a2 = [...a1]// 或者const [...a2] = a1原创 2020-06-01 11:41:59 · 171 阅读 · 0 评论 -
不能使用箭头函数的额地方
//定义对象的方法,不可以使用箭头函数,调用cat.jumps时候如果是普通的函数,this将指向cat,使用箭头函数的话this指向了全局对象,因此不会得到预期的效果.//这是因为对象不构成单独的作用域,导致jumps箭头函数定义时的作用域就是全局作用域const cat = { lives: 9, jumps:()=>{ this.lives-- }}// 这样写会报错,button的监听函数是一个箭头函数,导致里面的额this就是全局对象,如原创 2020-06-01 11:07:57 · 125 阅读 · 0 评论 -
数组打平
let arr = [1,2.58,[4,5,[6,9]],[8,9]]Array.prototype.flat = function(){ let arr = [] this.forEatch((item)=>{ if(Array.isArray(item)){ arr=arr.concat(item.flat()) }else{ arr.push(item) } }) return arr}console.log(arr.flat())原创 2020-05-31 21:34:02 · 603 阅读 · 0 评论 -
es6字符串新增方法
es5 String. fromChartCode(0x20BB7)从Unicode从码点返回对应字符串es6 String. formCodePaint()…………原创 2020-05-27 14:06:52 · 87 阅读 · 0 评论 -
遍历字符串
for(let codePoint of "foo"){ console. log(codePoint)}原创 2020-05-27 13:33:20 · 203 阅读 · 0 评论 -
解构赋值
let [a,b]=[1,2]let [foo,[[bar],baz]]=[1,[[2],3]]let [ , , the] = ["foo","bar","baz"]//the = "baz"let [head, ...tail]=[1,2,3,4]//head 1//tail [2,3,4]//结构赋值允许默认值let [foo=true]=[]原创 2020-05-27 10:43:56 · 82 阅读 · 0 评论 -
在所有情况下取到顶层对象
方法一(typeof window !=="undefeated" ? window : ( typeof process === "object"&& typeof require === "function"&& typeof global === "object" ) ?global :this )方法二var getGlobal = function (){ if(typeof self !=="un原创 2020-05-27 10:14:13 · 76 阅读 · 0 评论 -
自己撸一个react
/** * * @param {str|function} 类型,是字符串div 还是函数 * @param {*} jsx传递的属性 * @param {...any} 子元素 */function createElement(type, props, ...children) { delete props.__source return { type, props: { ...props, children: children.m..原创 2020-05-25 22:32:38 · 240 阅读 · 0 评论 -
let和const
{ let a=1; var b=11}a //ReferenceError:a is not definedb//11for循环的计数器适合let对比两个循环var a =[]for(var i=0; i<10; i++){ a[i]=function(){ console. log(i) }}a[6]()//10以上代码变量i是由var声明的,在全局范围类都有效,所以全局只有一个变量i。var a=[]for(let i=0; i<1原创 2020-05-26 11:58:32 · 82 阅读 · 0 评论 -
移动端自适应代码
function fixFontSize() { var _width = window.innerWidth; var _font = (_width / 750) * 40; document.documentElement.style = "font-size: " + _font + "px !important;"; } fixFontSize(); window.onresize = fixFontSiz原创 2020-05-20 11:12:46 · 291 阅读 · 0 评论 -
前端搜索
//用了双向绑定 onChange = (e) => this.setState({ filter: e.target.value }) filterList = (list, filter) => { function trim(value) { if (value && typeof value === 'string') { return value.replace(/^\s+|\s+$/g,''); } } ...原创 2020-05-20 11:02:55 · 95 阅读 · 0 评论 -
react中监听scroll
1.document.body.clientWidth //浏览器窗口的宽度2.div.clientWidth //div的宽度 3.div.offsetLeft //div距离左侧的宽度 4.div.scrollLeft // 滚动条滚动的距离 设置滚动的距离: div.scrollBy(200, 0) //横向 div.scrollBy(0, 200) //纵向 滚动的位置: div.scrollTo(300,100) div.scrollTo(0,0) //滚动到起始位置..原创 2020-05-20 10:59:44 · 1180 阅读 · 0 评论 -
清除scroll的滚动条样式
::-webkit-scrollbar { width: 0; height: 0; }原创 2020-05-20 10:58:15 · 900 阅读 · 0 评论 -
消除iOS橡皮筋效果
document.body.addEventListener('touchmove', function (e) { e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)},原创 2020-05-20 10:55:53 · 285 阅读 · 0 评论 -
Array.reduce()
const array1=[1,2,3,4]const reducer = (accumulator, currenValue)=>accumulator+currenVAlueconsole. log(array1.reduce(reducer))//10reducer 接收四个参数1累加器2当前值3当前索引4源数组reduce两个参数callback initValue原创 2020-05-19 18:00:17 · 79 阅读 · 0 评论 -
typescript学习,不断更新中
第一个ts实例const hello : string = "hello"console. log(hello)typescript安装npm i -g typescripttsc -v 查看版本var message:string = "hello"console. log(messag)//test.ts文件//tsc test. ts编译ts文件//生成test.jsvar meaasge="hello"console. log(message)用node命令执行一下原创 2020-05-16 16:09:50 · 146 阅读 · 0 评论 -
npm 命令
npm i 安装npm i modulename —D 即–save写入dependencies发布到生产环境—D 即–save-dev写入devDependencies发布到开发环境-g全局安装 命令行使用npm i modulename 本地安装,./node_modules下原创 2020-05-16 15:42:02 · 102 阅读 · 0 评论 -
Generator简述
Generator是一个状态机,也是一个遍历器生成对象function* hellofn(){ yield “hello” yield “world” return “end”}var h=hellofn()h.next()//{ value:"hello",done:false }h. next()//world falseh. next()// end trueh. next()//undefined true...原创 2020-05-15 16:51:23 · 169 阅读 · 0 评论 -
react 路由
react router中一切皆组价,路由器router,链接link,路由route,独占switch,重定向redirect都以组件形式存在渲染优先级 children>component>render原创 2020-05-15 16:18:46 · 97 阅读 · 0 评论