会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
zhoulixue
博客园
首页
新随笔
联系
订阅
管理
2023年3月8日
[常用函数]模拟单击双击
摘要: 小程序需要模拟双击事件,如果一个元素既绑定了单击事件,又绑定了模拟的双击事件,如何区分两个事件何时触发呢? 1. 设计一个点击事件分发函数 如果用户两次点击的时间间隔不大于300ms,认为发生了双击行为。 当用户点击一次后,等400ms,如果用户没有发生第二次点击,则认为是单击 export fun
阅读全文
posted @ 2023-03-08 16:33 zhoulixue
阅读(282)
评论(0)
推荐(0)
2023年3月7日
[常用函数]深拷贝
摘要: 判断类型见: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
阅读(23)
评论(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
阅读(27)
评论(0)
推荐(0)
2022年10月13日
mac os python安装问题
摘要: 首先直接下载官网安装包安装 https://www.python.org/downloads/ 然后配置环境变量 # 打开 ~/.bash_profile vim ~/.bash_profile # 写入环境变量,保存 export PATH="/Library/Frameworks/Python.
阅读全文
posted @ 2022-10-13 19:57 zhoulixue
阅读(131)
评论(0)
推荐(0)
2021年11月18日
[ts]类
摘要: // 类 class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return `Hello, ${this.greeting}`; } } const
阅读全文
posted @ 2021-11-18 10:20 zhoulixue
阅读(37)
评论(0)
推荐(0)
2021年11月17日
[ts]接口
摘要: interface LabeledValue { label?: string; // 可选属性 } function printLabel(labelObj: LabeledValue) { console.log(labelObj.label); } const myObj = { size:
阅读全文
posted @ 2021-11-17 21:26 zhoulixue
阅读(75)
评论(0)
推荐(0)
[ts]基础类型
摘要: 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
阅读(53)
评论(0)
推荐(0)
[ts]泛型
摘要: 类型变量,一个组件可以支持多种数据类型的数据 基础用法 function identity<T>(arg: T): T { return arg; } const output = identity('myString'); console.log(output); 泛型变量 function id
阅读全文
posted @ 2021-11-17 10:04 zhoulixue
阅读(74)
评论(0)
推荐(0)
2021年11月8日
【跨域】jsonp的实现
摘要: 1.跨域是浏览器是浏览器的安全策略。协议、域名、端口号不同都会引起跨域。 2.html标签的src属性可以发起http请求,并不受跨域限制 服务端代码 服务端返回一段js执行代码,例如 func(data)。这段代码会在客户端执行 const http = require('http'); cons
阅读全文
posted @ 2021-11-08 14:46 zhoulixue
阅读(109)
评论(0)
推荐(0)
2021年11月5日
brew常用命令
摘要: 查看帮助 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
阅读(593)
评论(0)
推荐(0)
下一页
公告