流浪のwolf

卷帝

导航

2022年10月28日

自定义指令 v-imgerror 当图片的 src 资源 无效 就替换 默认的 src 显示图片

摘要: // 回顾自定义指令 // 作用 : 自定义一些对dom操作的快捷指令 // 前提:指令就是用来操作 dom (v-if /v-show/v-for ....) // 语法:Vue.directive(指令名字,{配置对象}) // 使用:<标签 v-指令名=“表达式/变量名” /> import 阅读全文

posted @ 2022-10-28 15:56 流浪のwolf 阅读(20) 评论(0) 推荐(0) 编辑

permission 文件 - 后台管理 element-admin 模板 作用-前置路由守卫

摘要: import router from "./router"; import { getToken } from "./utils/auth"; import NProgress from "nprogress"; // 引入一份进度条插件 import "nprogress/nprogress.cs 阅读全文

posted @ 2022-10-28 15:17 流浪のwolf 阅读(16) 评论(0) 推荐(0) 编辑

前端 vue.config.js 处理跨域问题 proxy 代理

摘要: 问: 业务中的跨域问题是如何解决的? 这个的话我们公司⼤概分了俩种环境,⼀种是开发的时候,⼀种是上⽣产的时候,开发的时候因为要对 接的后端可能会⽐较多,他们配置不太⽅便,这个时候采取的是⽐较⽅便的前端代理的⽅案,和谁对接 的时候就把target设置为对⽅的接⼝ip 解决跨域问题 要是上⽣产的话 通常 阅读全文

posted @ 2022-10-28 15:14 流浪のwolf 阅读(45) 评论(0) 推荐(0) 编辑

手动检查 token 是否过期

摘要: 1.在 存储 token 的时候说明登录了 此时 把时间戳记录一下 js-cookies - auth.js // 导入 js-cookie 用于操作 cookies import Cookies from "js-cookie"; const TokenKey = "hrsacc_admin_to 阅读全文

posted @ 2022-10-28 14:58 流浪のwolf 阅读(1439) 评论(0) 推荐(0) 编辑

Access to XMLHttpRequest at xxxx from origin xxx has been blocked by CORS policy: No 'Access-Control- Allow-Origin' header is present on the requested resource

摘要: 错误:控制台报错 ; network 自动发起了请求: 解决办法: 找到 \node_modules\sockjs-client\dist\sockjs.js 文件 然后 crtl + g 快捷键跳转到 1603 行 ,把他 注释掉 即可 ;ps:不需要重新启动 ; 阅读全文

posted @ 2022-10-28 14:44 流浪のwolf 阅读(37) 评论(0) 推荐(0) 编辑