摘要: https://juejin.cn/post/7111922283681153038#heading-38 阅读全文
posted @ 2022-11-03 23:58 浪浪浪浪浪浪浪浪 阅读(8) 评论(0) 推荐(0) 编辑
摘要: const urlSearchParams = new URLSearchParams(window.location.search); const params = Object.fromEntries(urlSearchParams.entries()); 阅读全文
posted @ 2022-10-27 11:02 浪浪浪浪浪浪浪浪 阅读(24) 评论(0) 推荐(0) 编辑
摘要: antd的modal组件,使用的时候,一般都需要手动去修改visible属性,创建编辑共用的时候,需额外维护数据。然后就想着封装一套不需要维护数据的Modal 1、onOk返回promise的时候,执行resolve会关闭弹窗,执行reject不关闭弹窗。不返回Promise的时候,点击会关闭弹窗2 阅读全文
posted @ 2022-10-26 14:23 浪浪浪浪浪浪浪浪 阅读(947) 评论(0) 推荐(0) 编辑
摘要: Funtion.prototype.call_ = (target, ...arguments) => { target = target || window; const symbolKey = Symbol(); target[symbolKey] = this; const res = tar 阅读全文
posted @ 2022-08-22 13:33 浪浪浪浪浪浪浪浪 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 适用于输入值的时候调接口等异步操作 如果想要在该input上绑定value属性的话行不通 import React from 'react' import { Input } from 'antd'; import debounce from 'lodash/debounce' const Debo 阅读全文
posted @ 2021-07-17 19:42 浪浪浪浪浪浪浪浪 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 该按钮一秒只能点击一次 import React from 'react'; import { Button } from 'antd'; import throttle from 'lodash/throttle' const throttleButton = (props) => { const 阅读全文
posted @ 2021-07-17 19:41 浪浪浪浪浪浪浪浪 阅读(217) 评论(0) 推荐(0) 编辑
摘要: import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend'; <DndProvider backend={HTML5Backend}> <Table columns={ 阅读全文
posted @ 2020-07-06 09:54 浪浪浪浪浪浪浪浪 阅读(697) 评论(0) 推荐(0) 编辑
摘要: 限制了元素宽度,文本超出的时候用...结尾,鼠标划上效果做一个弹框来展示文本内容。但是文本未超出的时候不需要弹框。 react 无法计算文本宽度和元素宽度,需要操作DOM来计算 react获取DOM实例的方法 constructor(props) { super(props); this.textR 阅读全文
posted @ 2020-05-21 15:05 浪浪浪浪浪浪浪浪 阅读(822) 评论(0) 推荐(0) 编辑
摘要: crollToAnchor = anchorName => { if (anchorName) { // 找到锚点 const anchorElement = document.getElementById(anchorName); // 如果对应id的锚点存在,就跳转到锚点 if (anchorE 阅读全文
posted @ 2020-04-15 15:58 浪浪浪浪浪浪浪浪 阅读(226) 评论(0) 推荐(0) 编辑
摘要: // 例子根据name字段来搜索 handleTreeData = (treeData, searchValue) => { if (!treeData || treeData.length 0) { return []; } const array = []; for (let i = 0; i  阅读全文
posted @ 2020-03-24 13:55 浪浪浪浪浪浪浪浪 阅读(1431) 评论(0) 推荐(0) 编辑