React 组件的“分阶段”渲染 https://zhuanlan.zhihu.com/p/139318295 https://github.com/awmleer/staged-components 也可用 useSWR import { useState } from "react"; import useSWR from "swr...
node 实现压力测试 autocannon 中文译为 自动炮, 是一款基于nodejs的压力测试工具,支持 命令行 和 写代码 来进行测试 npm 地址 www.npmjs.com/package/aut… 因为我是前端所有选择了这个。 其他诸如 ab、webbench均可。 全局安装autocannon npm i aut...
自己动手打造一款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...
原生js 实现jquery 的parents function getParents(el, parentSelector /* optional */) { // console.log(el); // If no parentSelector defined will bubble up all the way to *document* if...
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...
web worker实现倒计时 <CountDownTimer endTime={1569834068266} onEnd={this.onEndHandler.bind(this)} /> CountDownTimer.jsx import React from "react"; import styled from "styled...
antd-mobile组件库 swiper不自动滚动问题 01- 轮播图组件问题 问题原因: 需要请求后台数据,所以一开始数据设置为空;但设置了autoplay,导致冲突 现象: 一开始不自动播放,当你手动滑动一张后会自动播放 //获取轮播图数据 async getSwiper() { const {data,status} = await getSwiper...