摘要: 1.通过遍历目标节点、目标节点的父节点,依次溯源。 然后累加这些节点到其最近可定位的祖先节点的距离。向上直到document。 其中,需要使用到节点的offsetTop/offsetLeft属性,来获取节点到最近祖先元素的距离。(position不为static) 需要使用到getComputedS 阅读全文
posted @ 2019-11-26 16:52 chulai9527 阅读(791) 评论(0) 推荐(0) 编辑
摘要: v8 sort方法部分关于快速排序法的源码: function QuickSort(a, from, to) { // Insertion sort is faster for short arrays. if (to - from <= 22) { InsertionSort(a, from, t 阅读全文
posted @ 2019-11-15 16:37 chulai9527 阅读(342) 评论(0) 推荐(0) 编辑
摘要: v8--sort方法源码中对于长度较短的数组使用的是插入排序法。 部分源码: function InsertionSort(a, from, to) { for (var i = from + 1; i < to; i++) { var element = a[i]; // Pre-convert 阅读全文
posted @ 2019-11-14 23:55 chulai9527 阅读(192) 评论(0) 推荐(0) 编辑
摘要: \num 匹配 num,其中 num 是一个正整数。对所获取的匹配的引用。例如,'(.)\1' 匹配两个连续的相同字符。 例子: 正则:/(a)(b)\1/。此表达式的意思大概是对第一个()匹配结果的引用 类似于匹配 aba 然后获取a,b 检验: 例子: 正则:/(a)(b)\2/。此表达式的意思 阅读全文
posted @ 2019-11-14 21:56 chulai9527 阅读(1396) 评论(0) 推荐(0) 编辑
摘要: store的结构: city模块: 在各模块使用了命名空间的情况下,即 namespaced: true 时: 组件中访问模块里的state 传统方法: this.$store.state['模块名']['属性名'] 例如:this.$store.state.city.list。 控制台输出 thi 阅读全文
posted @ 2019-11-14 00:01 chulai9527 阅读(7002) 评论(0) 推荐(1) 编辑
摘要: 依赖包安装: /** * koa-bodyparser用于把formData数据解析到ctx.request.body * 通过ctx.request.body访问请求的参数 * koa-redis用于保存状态 */ npm install nodemailer koa-bodyparser koa 阅读全文
posted @ 2019-11-07 15:59 chulai9527 阅读(1082) 评论(0) 推荐(0) 编辑
摘要: koa2原生功能只提供了cookie的操作,但是没有提供session操作。session只能自己实现或者通过第三方中间件实现。 如果session数据量很小,可以直接存在内存中 如果session数据量很大,则需要存储介质存放session数据 数据库存储方案 将session存放在Redis数据 阅读全文
posted @ 2019-11-06 18:39 chulai9527 阅读(697) 评论(0) 推荐(0) 编辑
摘要: 对于POST请求的处理,koa-bodyparser中间件可以把koa2上下文的formData数据解析到ctx.request.body中 安装: npm install --save koa-bodyparser 使用演示: 1 const Koa = require('koa') 2 cons 阅读全文
posted @ 2019-11-06 15:51 chulai9527 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 报错内容: TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or Buffer. Received type object at ServerResponse.end (_http_o 阅读全文
posted @ 2019-11-02 10:54 chulai9527 阅读(8130) 评论(0) 推荐(0) 编辑
摘要: 报错提示: Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In G:\project\vue\nuxt-learn\node_modules\bac 阅读全文
posted @ 2019-10-30 13:54 chulai9527 阅读(492) 评论(0) 推荐(0) 编辑