token过期续签

时间:2023-2-23   作者:lininn   分类:   热度:53°    
时间:2023-2-23   分类:    热度:53  
/ 响应拦截器 instance.interceptors.response.use( response => { // 隐藏 loading 提示效果 Toast.clear() return response }, async error => { Toast.clear() // 1. 从 vuex 中获取 tokenInfo 对象,格式为: { token, refresh_token } const tokenInfo = store.state.tokenInfo // 2. ...

阅读全文>>

原生js 实现jquery 的parents

时间:2023-2-17   作者:lininn   分类:   热度:71°    
时间:2023-2-17   分类:    热度:71  
function getParents(el, parentSelector /* optional */) { // console.log(el); // If no parentSelector defined will bubble up all the way to *document* if (parentSelector === undefined) { parentSelector = document; } v...

阅读全文>>

node使用puppeteer爬取数据

时间:2023-2-14   作者:lininn   分类:   热度:74°    
时间:2023-2-14   分类:    热度:74  
const puppeteer = require('puppeteer'); (async () => { // 启动浏览器 const browser = await puppeteer.launch({ headless: true, // 默认是无头模式,这里为了示范所以使用正常模式 args: ['--no-sandbox', '--disable-setuid-sandbox'], }) // 控制浏览器打开新标签页面 const page = await browser.newP...

阅读全文>>

vue切换proxy不重启

时间:2023-2-13   作者:lininn   分类:   热度:86°    
时间:2023-2-13   分类:    热度:86  
config.json { "api": "http://localhost:9001" } // vue.config.js const hotRequire = modulePath => { // require.resolve可以通过相对路径获取绝对路径 // 以绝对路径为键值删除require中的对应文件的缓存 delete require.cache[require.resolve(modulePath)] // 重新获取文件内容 const target = require(modulePath) return target } ... prox...

阅读全文>>

web worker实现倒计时

时间:2023-1-29   作者:lininn   分类:   热度:107°    
时间:2023-1-29   分类:    热度:107  
<CountDownTimer endTime={1569834068266} onEnd={this.onEndHandler.bind(this)} /> CountDownTimer.jsx import React from "react"; import styled from "styled-components"; import WebWorker from "../../utils/worker"; let work = function() { let timer = null; this.onmessag...

阅读全文>>

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

时间:2023-1-12   作者:lininn   分类:   热度:124°    
时间:2023-1-12   分类:    热度:124  
01- 轮播图组件问题 问题原因: 需要请求后台数据,所以一开始数据设置为空;但设置了autoplay,导致冲突 现象: 一开始不自动播放,当你手动滑动一张后会自动播放 //获取轮播图数据 async getSwiper() { const {data,status} = await getSwiper() if (status === 200) { this.setState( { swiper: data }, () => { ...

阅读全文>>

es6观察者模式

时间:2022-11-2   作者:lininn   分类:   热度:269°    
时间:2022-11-2   分类:    热度:269  
// 被观察的目标对象 let obj = { name: 'zyc', csdn: '博客'}; // 观察者 function print() { console.log('对象被操作了!'); } // 使用proxy代理 const observeObj = (obj) => new Proxy(obj, {set, get}); // 消息队列 const observeQueue = new Set(); const observe = (fn) => observeQueue.add(fn); // 设置 function set(target, key,...

阅读全文>>

swiper 出现闪屏 antd-mobile

时间:2022-11-1   作者:lininn   分类:   热度:264°    
时间:2022-11-1   分类:    热度:264  
在做一个移动端项目时,用swiper 做的页面切换,但是页面里面还会有swiper轮播图 和其他内容,在滑动外部swiper时,除开里面swiper的元素会发生闪动的情况。 解决方法:给外部元素的父标css套一个:transform:translate3d(0,0,0);overflow:hidden; 闪动元素/子元素:transform:translate3d(0,0,0)

阅读全文>>

node连接mysql以及防注入的手段

时间:2022-10-28   作者:lininn   分类:   热度:274°    
时间:2022-10-28   分类:    热度:274  
安装mysql $ yarn add mysql 建立连接池、常用sql语句 // mysql.js const mysql = require('mysql'); // 创建连接池 const pool = mysql.createPool({ host: 'xxx.xx.xxx.xxx', // 服务器ip port: 3306, // mySql运行的端口号(默认3306) database: 'name', // 数据库名称 user: 'user', // 数据库用户 passwor...

阅读全文>>

Webpack5把微前端qiankun的配置文件tree sharking了

时间:2022-10-17   作者:lininn   分类:   热度:283°    
时间:2022-10-17   分类:    热度:283  
network面板通过基座加载子应用时候,出现了一个js文件404 这里面很蹊跷,因为子应用单独可以启动,子应用被基座家加载时候只有一个js文件404了,而且是一个异步加载的js,那么可以判断,肯定是加载逻辑这块出了问题 在子应用中调试,打开public-path文件发现没有运行 核心问题是:当时发现子应用的__webpack_publicPath__这个变量没有被修改,所以造成了请求的host不对,异步加载的js文件404了 文件被webpack5给tree sharking了 在package.json中添加的sideEffects字段 ...

阅读全文>>

返回顶部    首页    手机版本    后花园   会员注册   
版权所有:覆手为雨    站长: lininn