琐碎知识点(一直更新)

前端:

1、const c = a + '和' + b 同 const c = `${a} 和${b}`

2、生命周期函数过程:
父 beforeCreate -> 父 created -> 父 beforeMount -> 子 beforeCreate -> 子 created -> 子beforeMount -> 子 mounted -> 父 mounted
父 beforeUpdate -> 子 beforeUpdate -> 子 updated -> 父 updated
父 beforeUpdate -> 父 updated
父 beforeDestroy -> 子 beforeDestroy -> 子 destroyed -> 父 destroyed


3、(id or class):foucs-within子元素获取焦点可以触发

4、树结构转换

/**
 * 构造树型结构数据
 * @param {*} data 数据源
 * @param {*} id id字段 默认 'id'
 * @param {*} parentId 父节点字段 默认 'parentId'
 * @param {*} children 孩子节点字段 默认 'children'
 */
export function handleTree(data, id, parentId, children) {
  let config = {
    id: id || 'id',
    parentId: parentId || 'parentId',
    childrenList: children || 'children'
  };

  var childrenListMap = {};
  var nodeIds = {};
  var tree = [];

  for (let d of data) {
    let parentId = d[config.parentId];
    if (childrenListMap[parentId] == null) {
      childrenListMap[parentId] = [];
    }
    nodeIds[d[config.id]] = d;
    childrenListMap[parentId].push(d);
  }

  for (let d of data) {
    let parentId = d[config.parentId];
    if (nodeIds[parentId] == null) {
      tree.push(d);
    }
  }

  for (let t of tree) {
    adaptToChildrenList(t);
  }

  function adaptToChildrenList(o) {
    if (childrenListMap[o[config.id]] !== null) {
      o[config.childrenList] = childrenListMap[o[config.id]];
    }
    if (o[config.childrenList]) {
      for (let c of o[config.childrenList]) {
        adaptToChildrenList(c);
      }
    }
  }
  return tree;
}

5、虚拟机开启docker:

        linux虚拟机不需要改动。

        windows虚拟机:

                虚拟机软件开启虚拟化Intel VT-x/EPT或AMD-V/RVI;

                主机关闭HV服务;

                主机关闭Hyper-V;

                服务器开启Hyper-V。

6、整个mysql运行sql文件:mysql -uroot -p < xxx.sql

7、docker换harbor:进入/etc/docker 换cert.d文件;根目录编辑hosts

8、npm下载地址:

        npm install --registry=https://registry.npmmirror.com

9、ssh:

ssh远程拷贝:scp root@ip:/root/data C:/data

ssh远程传入:scp -r C:/data root@ip:/root/data

10、根据端口号停止服务:

windows:

(1)netstat -ano | findstr "port"

(2)taskkill /pid "pid" /f

linux:

(1)lsof -i :"port"

(2)kill -9 "pid"

10、ubuntu分卷压缩

        tar cvzpf - file | split -d -b 50m
        cat x*>file.tar.gz
        tar xzvf file.tar.gz

11、css自定义属性(切换主题)

css:
:root[data-theme="dark"]{
    --text-color: black;
}
:root[data-theme="light"]{
    --text-color: blue;
}

script:
document.documentElement.setAttribute("data-theme", "dark");
document.documentElement.setAttribute("data-theme", "light");

css:
.index-title-text {
  color: var(--text-color);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值