非常简单的清除axios请求(vue,react通用) 1、添加js文件实现添加与删除接口的功能。import axios from 'axios'class CancelToken { // 声明一个 Map 用于存储每个请求的标识 和 取消函数 static pending = new Map() // 白名单, 写入接口名称 static whiteRequest = [] /** * 得到该格式的url * @param {AxiosRequestConfig} config * @returns
简单的聊天室 基于express+socket.ioexpress框架直接安装后得到模板这是socket官网的例子: https://socket.io/get-started/chat/** * Module dependencies. */var app = require('../app');var debug = require('debug')('server:server');var http = require('http');const { Server } = require("soc
滚动一屏距离 const top_page = () => { if (document.documentElement.scrollTop === 0) { return } let timmer; let h = document.documentElement.clientHeight let n = 0 timmer = setInterval(() => { n++; console.log.
滚动页面触发相应位置动画 ---react 需要实现的效果: (滚动到内容区域触发)第一段内容移动效果第二段内容淡入第三段内容缩放实现思路 滚动过的距离+当前窗口的高度>元素到顶部窗口的距离 ===>则触发动画整体代码import React,{useRef,useEffect,useState} from 'react';// 此函数用于获取一个元素到最外层窗口的距离// 接收两个参数// obg---> Dom元素// direction----->方向 top|bottom|left|
vue路由权限 1,配置每个页面的meta信息meta:{ grade:[1,2,3], //权限等级 title:'页面标题', icon:'图标', show:'是否展示导航'} 2,将无权限的页面路由直接配置到routeslet routes = [ { path: '/login', name: 'login', component: () => import('../components/login/login.vue') }, // 404 {
百度地图实用案例 1、创建一个js文件export function BMPGL(ak) { return new Promise(function (resolve, reject) { window.init = function () { // eslint-disable-next-line resolve(BMapGL) } const script = document.createElement('scri
vue递归组件 这是用来展示后台左侧导航的代码<template> <div> <el-menu router unique-opened> <el-submenu :index="index + ''" v-for="(obj, index) in data" :key="obj.name" > <template slot="title"> <router-link :to=".
前端面试题网址合辑 八个笔试&面试仓库1.Front-end Developer Interview Questions网址:https://h5bp.org/Front-end-Developer-Interview-Questions/2.CS-Interview-knowledge-Map网址:https://github.com/InterviewMap/CS-Interview-Knowledge-Map3.Daily-Question网址:https://github.com/shfshanyue
react如何在父组件中调用子组件事件 类组件将子组件的this传到父组件,给父组件添加一个属性,值为this,之后就可以通过父组件的属性调用子组件的事件了import React,{Component} from 'react';class View extends Component{ FunCenter = (_this) => { this.$child = _this; }; FunRecovery() { console.log() this