11 2022 档案

摘要:在页面中插入 a 标签方式下载文件,避免新开窗口导致的闪烁 1 function downloadFile(file) { 2 fetch(file.fileUrl) 3 .then(res => res.blob()) 4 .then(blob => { 5 const a = document. 阅读全文
posted @ 2022-11-17 14:53 yuhui_yin 阅读(131) 评论(0) 推荐(0)
摘要:1. input-number 限制输入整数 添加属性 :precision=“0” 2. 设置 rules 后,blur 时校验 默认 trigger 是 change,focus 后没有变化就 blur 不会校验,手动设置 trigger 为 blur 即可 阅读全文
posted @ 2022-11-14 17:55 yuhui_yin 阅读(63) 评论(0) 推荐(0)
摘要:之前一直没有搞明白 use 和 component 的区别 今天终于搞明白了,记录一下避免之后忘记 首先每个组件都会提供一个 install 方法,在这个方法里通过 component 注册组件 另外组件库提供一个入口文件,在入口文件里使用 use 实现对每一个组件的注册 在 vue 项目的入口文件 阅读全文
posted @ 2022-11-08 23:52 yuhui_yin 阅读(170) 评论(0) 推荐(0)
摘要:使用 navigator 提供的剪贴板能力复制 export const useCopy = async (str: string) => { try { await navigator.clipboard.writeText(str) console.log('复制成功') } catch (e) 阅读全文
posted @ 2022-11-08 23:06 yuhui_yin 阅读(56) 评论(0) 推荐(0)