- 博客(10)
- 收藏
- 关注
原创 JS数据转换,树形结构和平铺结构的转换
在实际的业务或者说面试,会有将树形转为平铺,或者是平铺转换为树形的需求,下面我们来写一下两者转化的区别. 首先给大家介绍一下数据结构展现的方式 这是树形结构数据: const arr= [{ id: 1, name: 'A', children: [{ id: 11, name: 'A1', children: [{
2022-04-24 19:13:14
4025
2
原创 简易小盒子拖拽 typeScript版
tsx代码 interface Isprops { } interface State { x: number, y: number } export default class index extends Component<Isprops, State> { x: number = 0 y: number = 0 disX: number = 0 disY: number = 0 boxRef=createRef<HTMLDivElement>
2022-04-24 18:57:48
1343
原创 面试题 扑克牌解法
从扑克牌中随机抽5张牌,判断是不是一个顺子, 即这5张牌是不是连续的2~10为数字本身, A为1。 J为11、Q为12、 为13。小王可以看成任意数字 function getPoker() { var arr = ['A', 2, 3, 4, 5, 6, 7, 8, 9, 'J', 'Q', 'K'] arr = [...arr, ...arr, ...arr, ...arr, '大王', '小王'] var newArr ...
2022-04-20 07:32:23
578
原创 文件框拖拽 拉伸
代码奉上 tsx代码: import React, { Component, RefObject } from 'react' import './index.css' interface Iprop { } interface Istate { arr: arr[] } interface arr { id: symbol, txt: string } export default class index extends Component<Iprop, Ist
2022-03-27 20:13:43
821
原创 极简风,双球拖拽 (交叉版)
tsx代码 import React, { Component } from 'react' import './index.css' interface Iprop { } interface Istate { } export default class index extends Component<Iprop, Istate> { constructor(props: Iprop) { super(props) this.state = {}
2022-03-25 10:57:22
222
原创 react+ts小球抛物线
代码奉上 css: html,body{ height: 100%; } #root,.App,.wrap{ height: 100%; width: 100%; } .ball{ width: 60px; height: 60px; border-radius: 50%; position: absolute; background-color: tomato; transition: left 1s linear, top
2022-03-22 10:30:33
1164
原创 react+ts 双球滑动,碰撞
直接上代码 tsx部分: import React, { Component, createRef } from 'react'; import './index.less' interface Props { } interface State { } class Ball extends Component<Props, State> { // ref获取线div line = createRef<HTMLDivElement>() // wrap
2022-03-21 16:04:49
313
原创 react+ts 双球拖动滑块效果,碰撞
直接上代码 tsx部分: import React, { Component, createRef } from 'react'; import './index.less' interface Props { } interface State { } class Ball extends Component<Props, State> { // ref获取线div line = createRef<HTMLDivElement>() // wrap
2022-03-21 15:58:43
1533
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅