自己动手打造一款React路由守卫

react路由 大家先不要急,我们先温习下react基本的路由搭建过程。由于react路由统一管理不唯一,此处列举的是基于useRoutes的路由管理。 1. 下载安装 npm install react-router-dom @6 复制代码 2. index.js挂载 import React fro...

token过期续签

/ 响应拦截器 instance.interceptors.response.use( response => { // 隐藏 loading 提示效果 Toast.clear() return response }, async error => { Toast.clear() // 1. 从 vue...

node使用puppeteer爬取数据

const puppeteer = require('puppeteer'); (async () => { // 启动浏览器 const browser = await puppeteer.launch({ headless: true, // 默认是无头模式,这里为了示范所以使用正常模式 args:...

vue切换proxy不重启

config.json { "api": "http://localhost:9001" } // vue.config.js const hotRequire = modulePath => { // require.resolve可以通过相对路径获取绝对路径 // 以绝对路径为键值删除require...

antd-mobile组件库 swiper不自动滚动问题

01- 轮播图组件问题 问题原因: 需要请求后台数据,所以一开始数据设置为空;但设置了autoplay,导致冲突 现象: 一开始不自动播放,当你手动滑动一张后会自动播放 //获取轮播图数据 async getSwiper() { const {data,status} = await getSwiper...

es6观察者模式

// 被观察的目标对象 let obj = { name: 'zyc', csdn: '博客'}; // 观察者 function print() { console.log('对象被操作了!'); } // 使用proxy代理 const observeObj = (obj) => new Proxy...

swiper 出现闪屏 antd-mobile

在做一个移动端项目时,用swiper 做的页面切换,但是页面里面还会有swiper轮播图 和其他内容,在滑动外部swiper时,除开里面swiper的元素会发生闪动的情况。 解决方法:给外部元素的父标css套一个:transform:translate3d(0,0,0);overflow:hidden;...