05 2021 档案

摘要:// 构造函数 function Promise(executor){ this.promiseState = 'pending'// 状态 this.promiseResult = undefined// 结果 this.callbacks = []// 指定多个回调函数 const self = 阅读全文
posted @ 2021-05-21 16:22 pangqianjin 阅读(68) 评论(0) 推荐(0) 编辑
摘要:前端延时随机函数模拟抽奖 点击按钮,模拟抽奖 延时1s返回结果 效果: 普通的使用回调方式的实现 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" con 阅读全文
posted @ 2021-05-20 20:33 pangqianjin 阅读(44) 评论(0) 推荐(0) 编辑
摘要:设置一个标识位,表示是否正在发送请求let isSending = false 具体代码: // 1.创建对象 let xhr = null let isSending = false const btn = document.getElementsByTagName('button')[0] bt 阅读全文
posted @ 2021-05-20 19:20 pangqianjin 阅读(175) 评论(0) 推荐(0) 编辑
摘要:如果只使用类式组件,满足以下功能很容易: 在组件挂载时,启动定时器,每隔1s加1; 组件将要卸载时,停止定时器 点击按钮卸载组件 具体实现: import React, { Component } from 'react' import ReactDOM from 'react-dom' expor 阅读全文
posted @ 2021-05-19 18:24 pangqianjin 阅读(115) 评论(0) 推荐(0) 编辑
摘要:一、首先写一个server.js,用于模拟服务器,并启动 // 1.引入express const express = require('express') // 2.创建express应用对象 const app = express(); // 为了使用req.body解析post请求的参数 ap 阅读全文
posted @ 2021-05-15 15:13 pangqianjin 阅读(165) 评论(0) 推荐(0) 编辑
摘要:安装pubsub-js 使用npm安装:npm install pubsub-js 使用yarn安装:yarn add pubsub-js 引入 import PubSub from 'pubsub-js' // or when using CommonJS const PubSub = requi 阅读全文
posted @ 2021-05-11 18:14 pangqianjin 阅读(836) 评论(0) 推荐(0) 编辑
摘要:一、在src目录下建立setupProxy.js, 使用CJS(common JS)语法配置代理,适合一个或多个代理 const proxy = require('http-proxy-middleware') module.exports = function(app){ app.use(//传入 阅读全文
posted @ 2021-05-09 16:19 pangqianjin 阅读(501) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示