摘要: 版本 node v18.12.0 egg ^3.17.5 背景 先前执行 yarn start 可以正常启动,今日修改代码再次启动,发现报错,如下图(比较长没有截完) 排查与解决 1. 默认 node 版本16.18.0,vue3 项目要更高的版本,因此导致项目起不来还比较频繁,于是先忽视报错,无脑 阅读全文
posted @ 2024-03-19 15:02 yuhui_yin 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1 // vite.config.js 2 3 import postcssPluginPx2rem from 'postcss-plugin-px2rem' 4 5 export default defineConfig({ 6 css: { 7 postcss: { 8 plugins: [ 9 阅读全文
posted @ 2024-01-31 09:17 yuhui_yin 阅读(45) 评论(0) 推荐(0) 编辑
摘要: vue 3.2.x + antdv 3.2.x 需求: 使用了某个复合组件,组件内按钮点击将使用弹窗展示某些信息 需求添加一个全屏按钮,点击后将复合组件全屏展示 问题: 刚拿到这个需求时想着,vueuse 几行代码搞定,也这么实现了 然而痛苦的事情出现了,全屏后 modal 不见了,退出全屏后发现其 阅读全文
posted @ 2023-08-09 09:34 yuhui_yin 阅读(219) 评论(0) 推荐(0) 编辑
摘要: vue3 const width = '500px' div { width: v-bind(width); // 也可以用引号引起来 } 阅读全文
posted @ 2023-07-13 09:42 yuhui_yin 阅读(7) 评论(0) 推荐(0) 编辑
摘要: vue2: <template v-for="(_, name) in $scopedSlots" v-slot:[name]="data"> <slot :name="name" v-bind="data"/> </template> vue3: <template v-for="name in 阅读全文
posted @ 2023-07-03 11:27 yuhui_yin 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 背景: 页面的 vue 文件引入了 js 文件,这个 js 文件中是抽离的一些变量,用到了 store pinia 是在 main 文件中注册的 问题: import { storeToRefs } from 'pinia' import { xxStore } from '@/store/xx' 阅读全文
posted @ 2023-02-16 16:57 yuhui_yin 阅读(539) 评论(0) 推荐(0) 编辑
摘要: 场景:列表页,可以切换 tab 展示获取对应类型的数据,懒加载,每次请求后拼接到已有列表后面 问题:快速切换,当前列表下会拼接上一个 tab 请求返回的数据 解决:使用 axios 的 cancelToken,发起请求时保存,切换时取消请求 axios 封装 // requestconst requ 阅读全文
posted @ 2023-01-28 15:55 yuhui_yin 阅读(633) 评论(0) 推荐(0) 编辑
摘要: 二者命令基本一致,日常使用如下 nrm:npm 源管理工具 # 安装 npm install nrm -g --save # 列出所有镜像源 nrm ls # 查看当前使用源 nrm current # 添加源,如公司内网镜像 nrm add sourceName url # 指定使用源 nrm u 阅读全文
posted @ 2022-12-29 09:21 yuhui_yin 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 背景:后端返回了一个 JSON.stringify 处理后的 json 字符串,希望在页面上展示格式化后的 方案: <pre>{{JSON.stringify(JSON.parse(jsonStr), null, 4)}}</pre> 直接渲染 修改之后 参考资料:JSON.stringify MD 阅读全文
posted @ 2022-12-08 15:48 yuhui_yin 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 在页面中插入 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 阅读(85) 评论(0) 推荐(0) 编辑