摘要: 1.准备 import React, { useReducer } from 'react'; 2.用于存放数据的函数 const initialGlobalState = { VariantOne: null, variantTow: null, }; 3.用于更改数据的函数 const glob 阅读全文
posted @ 2023-03-17 10:34 马铃薯头抽雪茄 阅读(160) 评论(0) 推荐(0)
摘要: 1.控制图片的信息 imgScale: '100%', // 图片放大缩小 imgTransform: '', // 旋转 imgCurrent: 0, // 当前的旋转 x: 0, // x移动 y: 0, // y移动 2.执行用的函数 // 放大 imgToBigger() { this.se 阅读全文
posted @ 2023-03-17 09:58 马铃薯头抽雪茄 阅读(250) 评论(2) 推荐(0)
摘要: 1.先看看转换的代码 1.base64转换为文件 dataURLtoFile(dataurl, filename) { const arr = dataurl.split(','); const mime = arr[0].match(/:(.*?);/)[1]; const bstr = wind 阅读全文
posted @ 2023-03-14 16:14 马铃薯头抽雪茄 阅读(402) 评论(0) 推荐(0)
摘要: 1.运动的效果 1 //Tween运动算法 2 Mover.prototype.Tween = { 3 /* 4 4个參数 5 t:current time(当前时间) 6 b:beginning value(初始值) 7 c: change in value(变化量) 8 d:duration(持 阅读全文
posted @ 2023-03-09 14:37 马铃薯头抽雪茄 阅读(140) 评论(0) 推荐(0)
摘要: 1 import { useRef, useEffect } from "react"; 2 export function useInterval(callback, delay) { 3 const savedCallback = useRef(); 4 5 useEffect(() => { 阅读全文
posted @ 2023-03-07 11:37 马铃薯头抽雪茄 阅读(147) 评论(0) 推荐(0)
摘要: npm i intersection-observer // 顶部引入 import 'intersection-observer'; // 字段解析 loadingText: PropTypes.string, // 加载文字 loadingIon: PropTypes.any, // 加载图标 阅读全文
posted @ 2023-03-06 16:56 马铃薯头抽雪茄 阅读(240) 评论(0) 推荐(0)
摘要: 1 componentWillMount () { 2 // 拦截判断是否离开当前页面 3 window.addEventListener('beforeunload', this.beforeunload); 4 } 5 componentWillUnmount () { 6 // 销毁拦截判断是 阅读全文
posted @ 2023-02-15 17:48 马铃薯头抽雪茄 阅读(31) 评论(0) 推荐(0)