上一页 1 2 3 4 5 6 7 8 9 ··· 14 下一页
摘要: 一、在传统开发过程中,我们的锚点都是 通过a标签跳转至对应ID的形式 进行需求实现的。 <a href="#content1">Menu1</a> <a href="#content2">Menu2</a> <div id="content1">Content1</div> <div id="con 阅读全文
posted @ 2020-08-03 14:26 CatherLee 阅读(3348) 评论(0) 推荐(0) 编辑
摘要: elementUI官网地址:https://element.eleme.cn/#/zh-CN/component/checkbox#checkbox-button-attributes 在el-checkbox元素中定义v-model绑定变量,单一的checkbox中,默认绑定变量的值会是Boole 阅读全文
posted @ 2020-08-03 11:58 CatherLee 阅读(2285) 评论(0) 推荐(0) 编辑
摘要: 场景:项目中我们会定义很多全局变量(如下) 为了更好的代码复用,避免写重复代码,问题的关键是怎么在我们的项目中引入这些文件。 方法1 <style lang="scss"> @import "./styles/_colors.scss"; </style> 在每个单文件组里引入上述代码。 这个方法的 阅读全文
posted @ 2020-08-03 11:07 CatherLee 阅读(3217) 评论(0) 推荐(0) 编辑
摘要: 原生AJAX AJAX 使用 XMLHttpRequest 对象进行请求发送和响应,局部刷新页面的技术。 流程如下: 生成 XMLHttpRequest 对象: let request = new XMLHttpRequest() 配置 XMLHttpRequest 对象: request.open 阅读全文
posted @ 2020-07-17 16:08 CatherLee 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 引入: let arr = Array.protorype.slice.call(arguments) 1、能不能写arguments.slice(1),当然不能,这样的话会报错,因为arguments是类数组对象,并没有slice这个方法 2、Array.prototype.slice.call( 阅读全文
posted @ 2020-07-15 17:50 CatherLee 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 利用数组,实现数组去重 注意⚠️; 场景:js常获取页面的dom树结构,存在集合中,如果使用Set, 即使dom元素被删除了,也不会被回收. 若是weakSet弱引用,会被垃圾回收机制回收。 Map 和 WeakMap 阅读全文
posted @ 2020-07-15 16:58 CatherLee 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 一、async await 概念 1. ECMAScript 2017 引入async函数,是generator 和 promises的语法糖,使异步代码更易于编写和阅读。通过使用它们,异步代码看起来更像是老式同步代码; 2. 不需要附加 .then() 代码块到每个promise-based方法的 阅读全文
posted @ 2020-07-15 16:03 CatherLee 阅读(199) 评论(0) 推荐(0) 编辑
摘要: JSON.parse(str) JSON.stringify(json) ⚠️: 字符串类型,不允许( .键名) 的方式。 jq 的 ajax 的 datatype 默认 json格式。 阅读全文
posted @ 2020-07-15 14:55 CatherLee 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 1、回调函数方式 2、promise 方式 3、generator方式 4、对比ajax, promise 和 generator 的应用场景 (一) (二) (三) 阅读全文
posted @ 2020-07-15 14:05 CatherLee 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 一、概念 yield: 停止。 二、语法 三、Generator案例 (抽奖案例) 四、长轮询(模拟网络连接) 上边是generator函数,下边call是普通函数。 迭代器方法会返回了{value:'',done:'状态,布尔值'},所以line24,要拿到属性值,再使用其then方法。 阅读全文
posted @ 2020-07-15 10:46 CatherLee 阅读(217) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 14 下一页