随笔分类 - js
摘要:简而言之:就是你用错了 这里的defineProperties应该改为defineProperty https://blog.csdn.net/return_MU/article/details/108121042
阅读全文
摘要:window.getComputedStyle(dom, null)['width']; https://blog.csdn.net/weixin_46112225/article/details/121940646
阅读全文
摘要:const div = document.createElement('div'); div.className = 'foo'; // 初始状态:<div class="foo"></div> console.log(div.outerHTML); // 使用 classList API 移除、添
阅读全文
摘要:e.currentTarget 为 事件所在元素的对象 e.target 为 点击元素的对象 e.target.dataset document.querySelector().dataset 以上都可以获取到自定义属性 data-index 所以e.target=document.querySel
阅读全文
摘要:const dfs=(r,c,flow)=>{ flow[r][c]=true let list = [[r-1,c],[r+1,c],[r,c-1],[r,c+1]].forEach(([nr,nc])=>{ if( //保证在矩阵中 nr>=0&&nr<m&& nc>=0&&nc<n&& //防
阅读全文
摘要:const text = "abc"; const chars = text.split(''); console.log(chars); //['a', 'b', 'c'] https://blog.csdn.net/lgno2/article/details/118837249
阅读全文
摘要:new Promise((resolve,rej)=>{resolve('1')}).then(r=>console.log(r,'test')).then(r=>{console.log(r,'test2'); return 'b';}).then(r=>{console.log(r)}).cat
阅读全文
摘要:let arr = [1, 2, 1, 3, 2, 4, 3, 5, 4] let newArr = [...new Set(arr)] console.log(newArr) https://www.cnblogs.com/zhimao/p/15126281.html
阅读全文
摘要:https://blog.csdn.net/lgno2/article/details/120775906
阅读全文
摘要:初步使用 const arr = [1, [2, 3, 4], 5]; arr.flat(); https://www.cnblogs.com/suihang/p/13606983.html
阅读全文
摘要:https://www.cnblogs.com/hepengqiang/p/9822118.html array.indexOf 返回坐标 array.includes返回true |false array.find返回值
阅读全文
摘要:element-ui form表单验证 https://element.eleme.cn/#/zh-CN/component/form js 原生表单验证 https://www.cnblogs.com/xiaobeiju/p/10224130.html <el-form ref="form" :m
阅读全文
摘要:官方给我们提供了一个方法来终止循环some(),ervey() https://blog.csdn.net/qq_34451048/article/details/111942317
阅读全文
摘要:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries https://baijiahao.baidu.com/s?id=16843877602507975
阅读全文
摘要:function test(){ console.log(this) }; test()//运行时this指向window var obj = {name: "李四", age: 20}; test.call(obj)//这样也算是以call指定完上下文再运行,此时this指向obj https:/
阅读全文
摘要:引入的地方加入type="module" https://www.cnblogs.com/threepigs/p/10572114.html 使用的地方也加入type="module" https://blog.csdn.net/you23hai45/article/details/10783574
阅读全文
摘要:方法.方法的形式,实际都是对象.方法,也就是第一个方法,返回了一个对象 https://www.zhihu.com/question/438348680
阅读全文