摘要: 小程序需要模拟双击事件,如果一个元素既绑定了单击事件,又绑定了模拟的双击事件,如何区分两个事件何时触发呢? 1. 设计一个点击事件分发函数 如果用户两次点击的时间间隔不大于300ms,认为发生了双击行为。 当用户点击一次后,等400ms,如果用户没有发生第二次点击,则认为是单击 export fun 阅读全文
posted @ 2023-03-08 16:33 zhoulixue 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 判断类型见:https://www.cnblogs.com/zhoulixue/p/17187385.html // 深拷贝 export const deepclone = (source: any) => { if (getType(source) 'Object') { return Obje 阅读全文
posted @ 2023-03-07 11:15 zhoulixue 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 获取类型 // 获取数据类型 export const getType = (o: any) => Object.prototype.toString.call(o).slice(8, -1); export const isObject = (o: any) => getType(o) 'Obje 阅读全文
posted @ 2023-03-07 11:12 zhoulixue 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 首先直接下载官网安装包安装 https://www.python.org/downloads/ 然后配置环境变量 # 打开 ~/.bash_profile vim ~/.bash_profile # 写入环境变量,保存 export PATH="/Library/Frameworks/Python. 阅读全文
posted @ 2022-10-13 19:57 zhoulixue 阅读(105) 评论(0) 推荐(0) 编辑
摘要: // 类 class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return `Hello, ${this.greeting}`; } } const 阅读全文
posted @ 2021-11-18 10:20 zhoulixue 阅读(32) 评论(0) 推荐(0) 编辑
摘要: interface LabeledValue { label?: string; // 可选属性 } function printLabel(labelObj: LabeledValue) { console.log(labelObj.label); } const myObj = { size: 阅读全文
posted @ 2021-11-17 21:26 zhoulixue 阅读(62) 评论(0) 推荐(0) 编辑
摘要: const iaMale: boolean = true; // 布尔值 const myAge: number = 18; // 数字 const myName: string = 'tom'; // 字符串 const scores: number[] = [100, 90, 80]; // 数 阅读全文
posted @ 2021-11-17 20:55 zhoulixue 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 类型变量,一个组件可以支持多种数据类型的数据 基础用法 function identity<T>(arg: T): T { return arg; } const output = identity('myString'); console.log(output); 泛型变量 function id 阅读全文
posted @ 2021-11-17 10:04 zhoulixue 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 1.跨域是浏览器是浏览器的安全策略。协议、域名、端口号不同都会引起跨域。 2.html标签的src属性可以发起http请求,并不受跨域限制 服务端代码 服务端返回一段js执行代码,例如 func(data)。这段代码会在客户端执行 const http = require('http'); cons 阅读全文
posted @ 2021-11-08 14:46 zhoulixue 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 查看帮助 brew -help 安装软件 brew install git 卸载软件 brew uninstall git 搜索软件 brew search git 显示已安装软件列表 brew list 更新 所有软件 brew update 更新某个软件 brew update git 显示软件 阅读全文
posted @ 2021-11-05 09:31 zhoulixue 阅读(504) 评论(0) 推荐(0) 编辑