- 博客(6)
- 收藏
- 关注
原创 函数组件Hooks+ts 拖拽
import { useState, useRef } from "react";import './Tab.less'export default function Fn() { // 获取盒子 const Drag = useRef<HTMLDivElement | null>(null) // 封装盒子 const getDrag = (): HTMLDivElement => { return Drag.current as H.
2022-04-02 20:41:40
303
原创 函数组件Hook+Ts 选项卡
ts代码:import { useState} from "react";import './Tab.less'interface iButtonList { ID: string text: string}export default function Fn() { const [ButtonList] = useState<iButtonList[]>([ { ID: 'bt1', text
2022-04-02 20:38:20
528
原创 盒子拖拽拉伸(和窗口一样的功能)React+Ts
TS:import React, { Component, createRef } from "react";import './index.less'interface Props {}interface State { arrList: arr[]}interface arr { id: symbol, text: string}export default class Haul extends Component<Props, State...
2022-03-28 15:20:54
1145
原创 React+Ts两个小球交叉滑动
less:.ad{ height: 100%; display: flex; justify-content: center; align-items: center;}.wrap{ width: 500px; height: 10px; background-color: #000; position: relative;}.line{ width: 100%; position: absolute;
2022-03-25 20:28:58
615
转载 【React+TS】从零开始搭建react+typescript+router+redux+less+px2rem自适应+axios反向代理+别名@+Antd-mobile
一、通过create-react-app脚手架创建项目npx create-react-app testproject --template typescript在vscode中打开项目,可以看到顺利生成了react项目且组件的后缀为tsx,此时说明成功创建了react+typescript项目的雏形在项目根目录下,运行npm run start,成功启动项目npm start二.配置路由npm i react-router-dom@5.2.0 react...
2022-03-16 21:45:07
1319
原创 React17.0最新rem转px
1.安装依赖npm i lib-flexible postcss-pxtorem -s2.暴露配置后在 config->webpack.config.js 进行配置(暴露前在node_modules 下面的react-scripts/config/webpack.config.js)在50行前添加下面代码const px2rem = require('postcss-pxtorem');3.在webpack.config.js 搜索: postcssOptions 把以下代
2022-03-14 18:54:46
514
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人