摘要: 最近遇到的实际应用场景:最外层的列表页需要缓存用户的筛选条件,最开始想到的就是使用keepAlive缓存组件,但是不能简单的外层套一个keepAlive,这样会使每个页面组件都缓存,但是当用户点击菜单时需要移除组件的缓存状态。这就是需要借助官方提供的两个 include实现,通过pinia管理需要缓 阅读全文
posted @ 2025-03-28 16:25 _只码农 阅读(65) 评论(0) 推荐(0)
摘要: 主要思路是调用接口获取重定向地址,并且需要进行UrlEncode,如果是内嵌在自己应用内,需要在页面上准备一个容器放置二维码。扫码后会跳转到重定向地址,此时路由会多几个参数,只需要监听路由参数的变化并触发对应方法即可。可参考官方文档 网站应用微信登录开发指南 下面是内置的方法步骤1:在index.h 阅读全文
posted @ 2024-03-19 15:45 _只码农 阅读(2557) 评论(0) 推荐(0)
摘要: 先上代码 1 const handleChangePosition = () => { 2 const element = canvasBox.value as HTMLDivElement; 3 let startX = 0, startY = 0, initialX = 0, initialY 阅读全文
posted @ 2024-01-18 15:39 _只码农 阅读(35) 评论(0) 推荐(0)
摘要: 最近上班遇到的新需求,token无感刷新,参考了很多博客,也看了渡一老师的视频,功能是实现了,但是发现重新请求后页面数据没有更新遇到相同问题的先理清代码执行顺序和Promise,看看执行结果有没有resolve()出去。话不多说,直接上代码,因为自己封装的请求和大家的不一样,仅供参考无感刷新toke 阅读全文
posted @ 2023-11-09 11:00 _只码农 阅读(703) 评论(0) 推荐(0)
摘要: 按照官网的方法引入zhCn import zhCn from 'element-plus/dist/locale/zh-cn.mjs' 编辑器报错:Could not find a declaration file for module 'element-plus/dist/locale/zh-cn 阅读全文
posted @ 2023-07-20 17:40 _只码农 阅读(1976) 评论(0) 推荐(0)
摘要: 解决方法在env.d.ts中加入下面代码 declare module '*.vue' { import { DefineComponent } from "vue" const component: DefineComponent<{}, {}, any> export default compo 阅读全文
posted @ 2023-06-05 15:59 _只码农 阅读(6339) 评论(0) 推荐(0)
摘要: // 选择图片后的处理 handleSelect(file, fileList) { let image = new Image() image.src = file.url image.onload = () => { if (image.width > 900) { compressImage( 阅读全文
posted @ 2023-04-10 10:53 _只码农 阅读(530) 评论(0) 推荐(0)
摘要: import {useRoute, useRouter} from "vue-router"; import {computed, ref, watch, watchEffect,nextTick} from "vue"; const router = useRouter() const route 阅读全文
posted @ 2023-04-01 18:28 _只码农 阅读(272) 评论(0) 推荐(0)
摘要: 首先安装需要的两个依赖 npm i @vueuse/core npm install element-plus --save 在main.js中引入css文件,自定义深色背景颜色 可以看ElementPlus官方网站 //引入elementUI import ElementPlus from 'el 阅读全文
posted @ 2023-04-01 17:52 _只码农 阅读(2362) 评论(0) 推荐(0)
摘要: 例子:封装el-pagination组件 <script lang="ts" setup> import {computed} from "vue"; const emit = defineEmits<{ ( e:'update:pageSize',pageSize:number):void //p 阅读全文
posted @ 2023-03-20 18:23 _只码农 阅读(105) 评论(0) 推荐(0)