![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
react
谢小妞
这个作者很懒,什么都没留下…
展开
-
antd Form.Item Switch 默认值
Form.Item Switch原创 2023-02-02 11:02:00 · 1613 阅读 · 0 评论 -
React 父组件调用子组件中的方法及子组件调用父组件方法
React父子组件通讯原创 2022-09-09 15:41:44 · 1205 阅读 · 0 评论 -
antd Table表格隐藏某一列
Table表格 删除 隐藏某列原创 2022-06-08 16:44:10 · 11015 阅读 · 13 评论 -
redux.js:275 Uncaught Error: Actions must be plain objects. Instead, the actual type was: ‘function‘
import store from './store'import { AUGMENT, SUBTRACT } from './antistop'export const augment = (data) => ({ type: AUGMENT, data })export const subtract = (data) => ({ type: SUBTRACT, data })// 异步定义的方法 action// store直接接收对象 异步传的是一个方法是不对的expor原创 2021-12-21 13:34:09 · 1781 阅读 · 0 评论 -
React路由组件传递参数
1.params参数路由链接(携带参数): <Link to='/demo/test/tom/18'}>详情</Link>注册路由(声明接收)<Route path="/demo/test/:name/:age" component={Test}/>接收参数:this.props.match.params2.search参数首先引入 querystring import qs from 'querystring'路由链接(携带参数):<转载 2021-12-14 14:14:32 · 1171 阅读 · 0 评论 -
Error: A <Route> is only ever to be used as the child of <Routes> element, never rendered directly.
原因React路由版本问题,你可以查看自己的package.json文件,查看react-router-dom的版本,应该是 6 版本。在 React-Router v6版本中,Route更改了使用方式。//最新语法<Routes> <Route path="/home" element={<Home />} /> <Route path="/about" element={<About />} /></Routes>原创 2021-12-13 17:15:32 · 546 阅读 · 0 评论 -
React订阅及发布
首先安装 pubsub-jsnpm i pubsub-js在组件中引入import PubSub from 'pubsub-js'订阅组件search = () => { PubSub.publish('atguigu',this.state.lebie) }发布组件 componentDidMount() { PubSub.subscribe('atguigu', (_, stateObj) => {原创 2021-11-29 11:35:02 · 325 阅读 · 0 评论 -
React解决跨域问题
1 package.json里面添加代理 proxy: { '/api': { target: 'http://localhost:5000/', // 后台服务地址以及端口号 ws: true, changeOrigin: true, //是否跨域 pathRewrite: { '^/api': '' } } },2 配置多个代理在项目目录src/下新建setu原创 2021-11-25 15:06:09 · 533 阅读 · 0 评论 -
reduce()的react的自我理解
render() { // console.log(this.props.shuodu.length) const {shuodu}=this.props // 取值不用花括号 // reduce是数组的方法 // reduce的方法传的两个值,一是方法,二是初始值0 // count 每次计算后的值, shuodus是shuodu调用的每一项 0是初始值 const bo...原创 2021-11-25 11:11:30 · 1084 阅读 · 0 评论 -
react高阶函数和函数柯里化 学习
import React, { Component } from 'react'class Optimize extends Component { state = { name: '', password: '' }// 高阶函数 // 函数中有函数是函数柯里化 message = (val) => { console.log(val) return (e) => { .原创 2021-11-15 15:04:05 · 529 阅读 · 0 评论 -
UnhandledPromiseRejectionWarning: Error: Cannot find module‘‘@tarojs/plugin-platform-weapp‘ from
版本号太高了npm install -g @tarojs/cli@1.2.26切换版本就可以了原创 2021-07-05 10:56:48 · 1921 阅读 · 1 评论 -
./node_modules/taro-ui/dist/weapp/index.ts Module not found: Can‘t resolve ‘./style/index.scss‘ in ‘
创建Taro 项目是正常的 安装了raroui就开始报错就是安装版本问题taro ui2.+和taro3.+版本不兼容npm install taro-ui@3.0.0-alpha.3完美解决原创 2021-07-05 10:19:59 · 1136 阅读 · 0 评论 -
React Native:侧滑删除组件SwipeableFlatList
案例:SwipeableFlatList主要实现代码: <SwipeableFlatList data={this.state.dataArray} renderItem={(data) => this.renderItemView(data)} //侧滑删除 renderQuickActions={() => this.quickActions()} maxSwipeDistance=原创 2021-06-03 10:15:19 · 493 阅读 · 0 评论 -
React tab 切换
打开文件import React, { Component } from "react";import Hello from "../components/Hello";import { Button } from "antd";export default class Gong extends Component { state = { data: ["数据11", "数据22", "数据333"], addressJobs: [ { addres原创 2021-05-10 15:16:55 · 342 阅读 · 0 评论 -
npm ERR! While resolving: undefined@undefined npm ERR! Found: umi@3.3.9 npm ERR! node_modules/umi np
$ npm inpm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency treenpm ERR!npm ERR! While resolving: undefined@undefinednpm ERR! Found: umi@3.3.9npm ERR! node_modules/uminpm ERR! umi@"^3.3.7" from the root projectnpm ERR!npm ERR! Co原创 2021-03-01 17:19:18 · 9539 阅读 · 0 评论 -
Raect的创建项目
由于今天被嘲笑!特地复习一遍安装脚手架 npm i create-react-app -g// 全局安装脚手架2使用脚手架// 创建项目 create-react-app [项目名]//注意:项目名不能含有大写字母,会报错3脚手架常用命令//运行项目npm run start/npm start//反编译(暴露项目的webpack配置)npm run ejectnpm run test//测试npm run build//打包...原创 2020-07-09 18:42:19 · 126 阅读 · 0 评论