react
小白耶
这个作者很懒,什么都没留下…
展开
-
table 将“rowKey”设置为唯一的主键的写法
<Table rowKey={(record, index) => index} columns={columns}dataSource={dataSource}pagination={false}/>原创 2021-01-29 15:29:53 · 2704 阅读 · 0 评论 -
react 点击分页滑动到页面顶部
//////方法:window.elGoTop = function (n) { document.querySelector(n) && document.querySelector(n).scrollTo({ top: 0, behavior: "smooth" });}//////使用: //列表查询 async listPageEquipmentcategory() { const {pagin.原创 2021-01-25 10:32:21 · 521 阅读 · 0 评论 -
react 路由跳转传值及接参
const columns = [ { title: '班级名称', dataIndex: 'className', key: 'className',align:'center'}, { title: '学生人数', dataIndex: 'studentCount', key: 'studentCount',align:'center'}, { title: '操作', dataIndex: 'c..原创 2021-01-25 10:17:15 · 335 阅读 · 0 评论 -
react 地址栏截取 (获取数据)
componentDidMount() { const data = this.props.location.search; //地址栏截取 if (data) { const param = data.split("?")[1]; const codeParam = param && param.includes("%") ? decodeURI(param) : param; c..原创 2021-01-25 10:11:08 · 979 阅读 · 0 评论 -
react 展开收起写法(手动展开收起 和 自动展开收起)
html写法:<div className="pack-unfold"> {isShow.includes(item.chapterId)? <span className='pack' onClick={() => this.isShow(item.chapterId,0)}>收起</span>: <span className='unfold' onClick={() => this.isShow(i.原创 2021-01-25 10:06:37 · 3043 阅读 · 0 评论 -
react 滚动条定位到顶部
1.react滚动条滚动到顶部:document.getElementById("root").scrollTo({ top: 0, behavior: "smooth"});2. react 返回事件 back = () => { this.props.history.goBack() }3.react 图片 <img src={require(`../../../../assets/img/train_space/fangan${i + ...原创 2020-10-12 08:55:26 · 2633 阅读 · 0 评论 -
react获取到鼠标滚动的高度
如果是特定id的dom对象的话,使用的是react的ref方法。//搜索列表鼠标滚动事件handleScroll(e){ let clientHeight = this.refs.bodyBox.clientHeight; //可视区域高度 let scrollTop = this.refs.bodyBox.scrollTop; //滚动条滚动高度 let scrollHeight = this.refs.bodyBox.scrollHeight; //滚动内容高度原创 2020-05-28 11:03:46 · 919 阅读 · 0 评论