摘要: 1、问题描述: 将当前数组中的(`name: '/'`)删除掉,并将当前children中的数组合并到父数组去。 2、数据格式: var data = [{ name: "A", children: [{ name: "1", children: [{ name: "01", children: [ 阅读全文
posted @ 2020-11-02 10:38 渡心° 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 什么是 reduce reduce() 方法对数组中的每个元素执行一个由您提供的reducer函数(升序执行),将其结果汇总为单个返回值 const array1 = [1, 2, 3, 4]; const reducer = (accumulator, currentValue) => accum 阅读全文
posted @ 2020-10-27 14:31 渡心° 阅读(633) 评论(0) 推荐(0) 编辑
摘要: React 装饰器配置 首先安装:@babel/plugin-proposal-decorators npm install -D @babel/plugin-proposal-decorators 根目录创建config-overrides.js const { override, addDeco 阅读全文
posted @ 2020-10-21 17:17 渡心° 阅读(303) 评论(0) 推荐(0) 编辑
摘要: session 原理 session会话机制是⼀种服务器端机制,它使⽤类似于哈希表(可能还有哈希表)的结构来保存信息。 实现原理: 服务器在接受客户端⾸次访问时在服务器端创建seesion,然后保存seesion(我们可以将seesion保存在内存中,也可以保存在redis中,推荐使⽤后者),然后给 阅读全文
posted @ 2020-09-24 10:46 渡心° 阅读(153) 评论(0) 推荐(0) 编辑
摘要: cookie 原理 Header Set-Cookie负责设置cookie 请求传递Cookie const express = require('express') const app = express() app.get('/', function(req, res) { const cook 阅读全文
posted @ 2020-09-24 10:33 渡心° 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 元素 操作符 $exists 匹配具有指定字段的文档 // mongodb 数据 [ {price: 1, name: 'xx 1', message: 'message 1'}, {price: 2, name: 'xx 2', message: null}, {name: 'xx 3', mes 阅读全文
posted @ 2020-09-17 11:25 渡心° 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 逻辑操作符 $and 并且 用逻辑联接查询子句and返回与两个子句条件都匹配的所有文档。 col.find({$and: [{ price: { $eq: 1 } },{ category: { $eq: '水果' } }] }) // 返回 price 1 并且 category '水果' 的数据 阅读全文
posted @ 2020-09-17 10:29 渡心° 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 操作符 $eq 匹配等于指定的值 col.find({price: {$eq: 1}}) // [{price: 1}] $gt 匹配大于指定的值 col.find({price: {$gt: 2}}) // [{price: 3}, {price: 4}, {price: 5}] $gte 匹配大 阅读全文
posted @ 2020-09-16 18:20 渡心° 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 简单说一下 Object.assign、JSON.stringify和Object.create 拷贝对象后的变化,以及实现深度拷贝方法。 阅读全文
posted @ 2020-08-28 15:21 渡心° 阅读(21860) 评论(0) 推荐(5) 编辑
摘要: 搭建 CLI 工具 创建工程 mkdir wangyong-cli cd wangyong-cli npm init -y 安装依赖: npm i commander download-git-repo ora handlebars figlet clear chalk open -s bin/in 阅读全文
posted @ 2020-08-26 17:09 渡心° 阅读(380) 评论(0) 推荐(0) 编辑