自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

原创 React+TS实现两小球碰撞

TS代码 import React, { Component, createRef } from 'react'; import './index.less' interface Props { } interface State { } class Ball extends Component<Props, State> { startX: number = 0 parent?: HTMLDivElement child!: HTMLCollection; .

2021-12-13 09:19:32 255

原创 react+TS实现返回顶部

第一种 js代码 import { Component, createRef } from "react"; import './scrolltop.css' interface Props { } interface State { } export default class ScrollTop extends Component<Props, State>{ ball = createRef<HTMLDivElement>(); time: num..

2021-12-10 10:43:12 422

原创 React路由 报错 ‘Switch‘ is not exported from ‘react-router‘.

配置 路由 报错 'Switch' is not exported from 'react-router'. npm uninstall react-router-dom npm install react-router-dom@5.2.0

2021-12-02 18:56:19 792

原创 JS数据转换 —— 树形结构和平铺结构的转换

正向-树形结构转平铺 // 正向-树形结构转平铺 // 从外到内依次递归,有 children 则继续递归 function treeToArr(data, pid=null, res=[]) { data.forEach(item => { res.push({ pid: pid, id: item.id, name: item.name }); if(item.children && item.children.length !== 0) {

2021-09-16 19:45:52 638

原创 React+tsx实现选项卡功能

tsx代码 import { Component } from "react"; import './index.less' interface Props { } interface User { ID: string, text: string } interface Con { ID: string, text: string } interface State { ButtonIndex: number ButtonList: User[]

2021-09-16 19:40:50 799

原创 vue脚手架中实现二级联动

html代码 <template> <div class="linkage"> <div class="linkage-button" ref="linkage-button"> <div class="linkage-button-list" ref="linkage-button-list"> <div :class=" index == ButtonListIn

2021-09-16 19:36:32 173

原创 创建react项目,并配置less,以及配置less报错的解决方式和修改源

1.修改源 查看源 npm config get registry 默认源 npm config set registry https://registry.npmjs.org 切换淘宝源 npm config set registry https://registry.npm.taobao.org 2.创建react项目 npm install -g create-react-app create-react-app 项目名称 3.在react中配置les...

2021-09-16 19:28:11 346

原创 React+tsx实现拖拽效果 (PC端+移动端)

tsx代码 import './index.less' import { Component, createRef } from 'react' interface Props { } interface State { } class Drag extends Component<Props, State> { disX: number = 0; disY: number = 0; dragElement = createRef<HTMLDivElemen

2021-09-16 19:11:15 589

原创 vue 中 进度条小球

交叉 <template> <div class="about"> <div class="line"></div> <div class="line active"></div> <div class="small-ball" @touchstart="FnStart"></div> <div class="small-ball ac" @touchstart="F

2021-08-23 11:53:37 440

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除