工具函数

154 阅读1分钟

pathToRegexp 路径匹配正则

npm 包名称:path-to-regexp, 他用于把一个类似于/user/:name的字符串转为规则的正则。

在 body 底部插入一个元素

const addRootElement = (elem) => {
  document.body.insertBefore(
    elem,
    null
  );
};