随笔分类 - 前端
摘要:接口 interface IModal { root: HTMLElement; container: HTMLElement; content: HTMLElement; mount(root?: HTMLElement): IModal; remove(): IModal; appendCont
阅读全文
摘要:示例 backdrop-filter: blur(10px); 兼容性 Chrome: >= 76 see https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter END
阅读全文
摘要:#fa709a background: #fa709a #b1b0c5 background: #2f2e49; color: #b1b0c5
阅读全文
摘要:空元素 JSX 允许空的根元素,从而打破深嵌套。ReactRouter.HashRouter等组件都是空元素实现的。 return ( < > < > <div></div> <div></div> </> </> ); import * as React from 'react'; import
阅读全文
摘要:Install yarn add react-router-dom import: import * as ReactRouter from 'react-router-dom'; 路由器 - ReactRouter.Router 路由器主要分两种模式:history和hash,其中ReactRou
阅读全文
摘要:代码 // 显示字幕下载标签页 let win = window.open(undefined); win.document.title = `下载字幕`; win.document.body.appendChild(window.wait_subtitle.cloneNode()); // 移花接
阅读全文
摘要:防抖动的UI更新 如果在很短的时间内重复设置状态,那么UI不会每次都更新,这属于防抖动。 这说明 setState() 内部有调用时间间隔的检测机制。 合并状态 React会合并第一级 state 字段。 善用异步 为了确保 setState() 会触发更新,可以善用异步sleep函数,而不是 th
阅读全文
摘要:创建script元素 var script = document.createElement('script'); document.head.appendChild(script); // insert into the <head></head> tag script.addEventListe
阅读全文
摘要:函数定义 /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned obje
阅读全文
摘要:函数定义 /** * Returns a stateful value, and a function to update it. * 返回一个有状态值,以及一个更新它的函数。 * * @version 16.8.0 * @see https://reactjs.org/docs/hooks-ref
阅读全文
摘要:"useBuiltIns" 默认为false, 不为每个文件自动添加polyfill,也不要进行转换import "core-js"或import "@babel/polyfill"更改为单个polyfill。 "usage": 按需导入填充物 填充物主要来自core-js、regenerator-
阅读全文
摘要:Blob & File Blob:Binary large Object,二进制大对象。 不可变的原始数据的类似文件的对象, 可以读取为文本或二进制数据, 也可以转换为ReadableStream然后使用其方法来处理数据。 Blob ⇒ ArrayBuffer Blob对象有一个异步的arrayBu
阅读全文
摘要:tsc 优点:可以生成.d.ts类型声明文件。 tsconfig.json: { "compilerOptions": { "outDir": "dist", "declaration": true, "declarationDir": "dist", }, "files": ["src/index
阅读全文
摘要:webpackUniversalModuleDefinition 通用模块定义: (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports 'object' && typeof module 'obje
阅读全文