daily-share
daily-share copied to clipboard
个人博客记录、内容在issues
IOS active 状态失效问题解决方案 ```js useEffect(() => { document.addEventListener('touchstart', () => {}, false); return () => { document.removeEventListener('touchstart', () => {}, false); }; }, []); ```
```jsx import React, { useEffect, useState } from 'react' import { Button, Avatar, Spin } from 'antd' import { toPng, toJpeg, toBlob, toPixelData, toSvg } from 'html-to-image' import F2 from...
```js // 构造函数的参数是一个异步任务 function Promise(task) { // 初始化工作 let that = this // 缓存this that.status = 'pending' // 默认状态为pending that.value = undefined // 此变量是promise的结果,成功的结果或失败的原因 // 成功回调函数 that.onResolvedCallbacks = [] //...
```tsx import React, { useEffect, useRef, useState } from 'react' import { createUseStyles } from 'react-jss' import AMapLoader from '@amap/amap-jsapi-loader' import zhizhen from '@/assets/images/zhizhen.png' const styles = createUseStyles({ content: {...
## 01 - for ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; let filePaths = []; for (let file of files) { const fileName = file.trim();...
 ## 效果代码 ```js import React from 'react' import SimulateInput from './component/SimulateInput/SimulateInput' const App = () => { return ( 请输入8位工号 {}} /> 请输入6位工号 {}} /> 请输入6位数密码 {}} /> )...
```js import React, { useState, useEffect } from 'react' import { Table } from 'antd' const App = () => { const [tableData, setTableData] = useState([]) const getTableData = ()...
## 实现快照沙箱 ```js // 沙箱就是互不影响,创造一个干净的环境, 当切换时,可以选择丢弃属性或恢复属性 // js沙箱 proxy // 快照沙箱 将区别保存起来 class SnpashotSandBox { constructor() { this.proxy = window this.modifyPropsMap = {} this.active() } active() { this.windowSnpashot = {}...
## redux 数据模型 ```jsx export default { state: { count: 1, flag: false, data: { count: 1, name: 'zs', }, }, reducers: { addCount: (state, number) => { return {...