摘要: Object.keys(..) 会返回一个数组,包含所有可枚举属性, Object.getOwnPropertyNames(..),会返回一个数组,包含所有属性,无论它们是否可枚举。 in 操作符会检查属性是否在对象及其 [[Prototype]] 原型链中,hasOwnProperty(..) 只 阅读全文
posted @ 2021-06-11 14:09 ltog 阅读(41) 评论(0) 推荐(0) 编辑
摘要: 单页面: 概念:就是只有一张Web页面的应用。单页应用程序 (SPA) 是加载单个HTML 页面并在用户与应用程序交互时动态更新该页面的Web应用程序。浏览器一开始会加载必需的HTML、CSS和JavaScript,所有的操作都在这张页面上完成,都由JavaScript来控制。单页面的跳转仅刷新局部 阅读全文
posted @ 2021-06-02 14:56 ltog 阅读(3645) 评论(0) 推荐(0) 编辑
摘要: // 转驼峰 function toCamelCase(str,pattern) { // replace第二个参数为一个函数时,在此场景中, // 第一个参数为正则匹配出来的内容, 依次是 -c -r -c, // 第二个参数是分组中的内容, 也就是 c r c return str.replac 阅读全文
posted @ 2021-04-22 14:18 ltog 阅读(104) 评论(0) 推荐(0) 编辑
摘要: --save-dev || -D // 开发依赖(辅助)--save || -S // 运行依赖(发布) –save : dependencies 键下,发布后还需要依赖的模块,譬如像Vue或者Angular框架类似的,我们在开发完后后肯定还要依赖它们,否则就运行不了。 –save-dev : de 阅读全文
posted @ 2021-04-20 19:38 ltog 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 数组扁平化 const arr = [1, 2, 3, [4, [5, 6, [7,8]]]]; console.log(arr.flat(Infinity)); // [1, 2, 3, 4, 5, 6, 7, 8] console.log(arr.join().split(',')); // [ 阅读全文
posted @ 2021-03-17 11:36 ltog 阅读(52) 评论(0) 推荐(0) 编辑
摘要: document.getElementById('copy').onclick = function () { let input = document.createElement('input'); input.setAttribute('id','input'); input.value = ' 阅读全文
posted @ 2021-03-12 18:36 ltog 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 1、含有多个条件的if语句 我们可以在数组中存储多个值,并且可以使用数组的 includes 方法。 //longhand if (x 'abc' || x 'def' || x 'ghi' || x 'jkl') { //logic } //shorthand if (['abc', 'def', 阅读全文
posted @ 2021-03-11 10:22 ltog 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 示例1:新旧节点不同 <template> <div id="app"> <hello-world :flag="flag" /> <button @click="toggle">toggle</button> </div> </template> <script> import HelloWorl 阅读全文
posted @ 2021-03-03 14:51 ltog 阅读(1417) 评论(0) 推荐(0) 编辑
摘要: 示例: <template> <div id="app"> <div ref="msg">{{ name }}</div> <button @click="change">change</button> <button @click="changeLast">changeLast</button> 阅读全文
posted @ 2021-02-26 11:06 ltog 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 例子 <template> <div id="app"> <!-- <hello-world />--> <div ref="msg">{{ msg }}</div> <button @click="change">change</button> </div> </template> <script 阅读全文
posted @ 2021-02-24 16:11 ltog 阅读(121) 评论(0) 推荐(0) 编辑