摘要: // 前置参数类型 type A = 'string' | 'boolean' // 类型关联MAP type B = { 'string': string 'boolean': boolean } type C<T extends A[]> = { [I in keyof T]: B[T[I]] 阅读全文
posted @ 2024-03-07 19:32 梦羽微澜 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 通过js获取视频/音频时长 const url = window.URL.createObjectURL(file) const audioElement = new Audio(url) audioElement.addEventListener('loadedmetadata', () => { 阅读全文
posted @ 2024-03-05 11:32 梦羽微澜 阅读(306) 评论(0) 推荐(0) 编辑
摘要: 深拷贝与浅拷贝 深拷贝 对象的深拷贝是指其属性与其拷贝的源对象的属性不共享相同的引用 点击查看MDN官网解释 即深拷贝是值的拷贝,拷贝后的对象与源对象完全独立,互不影响 浅拷贝 对象的浅拷贝是其属性与其拷贝的源对象的属性共享引用 --MDN 点击查看MDN官网解释 即深拷贝是值的地址的拷贝(针对引用 阅读全文
posted @ 2024-03-01 14:37 梦羽微澜 阅读(4) 评论(0) 推荐(0) 编辑
摘要: postMessage窗口间通信实现单点登录 方案一:iframe + postMessage + localStorage 方案二:postMessage + window.open 方案三:BroadcastChannel(推荐) 方案一:本地缓存:使用iframe + postMessage 阅读全文
posted @ 2024-02-29 17:47 梦羽微澜 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 在通过create-react-app创建的react应用中使用monaco-editor v0.44 下载包: npm i monaco-editor npm i monaco-editor-webpack-plugin 安装插件: 使用craco自定义webpack配置 npm i craco 阅读全文
posted @ 2024-01-05 09:56 梦羽微澜 阅读(517) 评论(1) 推荐(0) 编辑
摘要: **qiankun: https://qiankun.umijs.org/zh/guide** **demo源码gitee:https://gitee.com/philippines-kisses-snow/qiankun-demo** > 官方对微应用的说明:通常这种场景下微应用是一个不带路由的可 阅读全文
posted @ 2023-09-06 14:16 梦羽微澜 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 在网上看了几个无缝循环轮播的实现方法,使用方法都比较复杂,所以这里提供一种比较简单的实现方式 gitee: https://gitee.com/philippines-kisses-snow/rotation ## 结构和理论梳理 ### 理论 ![image](https://img2023.cn 阅读全文
posted @ 2023-08-18 11:09 梦羽微澜 阅读(706) 评论(0) 推荐(0) 编辑
摘要: leaflet:一个开源并且对移动端友好的交互式地图 JavaScript 库 中文文档:https://leafletjs.cn/reference.html 官网(英文):https://iclient.supermap.io/examples/leaflet/examples.html#iSe 阅读全文
posted @ 2023-03-31 15:38 梦羽微澜 阅读(1040) 评论(0) 推荐(2) 编辑
摘要: Array自带方法的实现 Array.flat const array1 = [1, 2, 3, 4, [5, 6], [7, [8, 9]]]; function flat(list) { return list.reduce((pre, next) => pre.concat( Array.is 阅读全文
posted @ 2023-03-02 14:53 梦羽微澜 阅读(8) 评论(0) 推荐(0) 编辑
摘要: componentDidMount/componentWillUnmount useEffect(() => { // 挂载后的操作 }, []) useEffect(() => { // 添加事件监听 return () => { // 取消事件监听 } }, []) componentDidUp 阅读全文
posted @ 2023-02-27 11:19 梦羽微澜 阅读(13) 评论(0) 推荐(0) 编辑