随笔分类 -  React从入门到改行

摘要:将 import { useRouter } from 'next/router'; 改为 import Router from "next/router"; 使用: Router.push('/'); 原来使用 import { useRouter } from 'next/router'; 会导 阅读全文
posted @ 2023-10-19 10:13 龙卷风吹毁停车场 阅读(108) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2023-09-27 10:16 龙卷风吹毁停车场 阅读(281) 评论(0) 推荐(0)
摘要:用JSON.stringify和JSON.parse处理下就可以了 阅读全文
posted @ 2023-09-22 13:47 龙卷风吹毁停车场 阅读(127) 评论(0) 推荐(0)
摘要:要修改里面的内容 阅读全文
posted @ 2022-10-08 14:15 龙卷风吹毁停车场 阅读(30) 评论(0) 推荐(0)
摘要:说起来也奇怪,我在react中使用的是axios来请求数据,pc端和安卓端都能成功,部分iOS机型请求状态为0(status为0),回调 res为undefined。找了大半天也不知道原因,后来用 fetch 来请求数据如图(1-1)在iOS中正常。后面猜想是不是请求头上的原因,结果还真是这个问题, 阅读全文
posted @ 2021-05-21 16:36 龙卷风吹毁停车场 阅读(1793) 评论(0) 推荐(0)
摘要:import React,{ useState ,useRef} from 'react' const VrCornucopiaHome = () => { const [projectContent,setProjectContent] = useState() const [projectCon 阅读全文
posted @ 2021-05-17 16:00 龙卷风吹毁停车场 阅读(2161) 评论(0) 推荐(0)
摘要:html import React,{ useState } from 'react' const VrCornucopiaHome = () => { const bbbbb = () => { alert(1) } return ( <button type="button" onClick={ 阅读全文
posted @ 2021-05-17 15:54 龙卷风吹毁停车场 阅读(247) 评论(0) 推荐(0)
摘要:使用route 之前需要先安装 react-router-dom yarn add react-router-dom -D 在src根目录下新建router.js文件 //router.jsimport React,{ Component } from 'react' import {Route, 阅读全文
posted @ 2021-05-12 14:20 龙卷风吹毁停车场 阅读(953) 评论(0) 推荐(0)
摘要:this.props.history.push('/home') 推荐使用 路由方式为 HashRouter 阅读全文
posted @ 2021-05-12 10:59 龙卷风吹毁停车场 阅读(56) 评论(0) 推荐(0)
摘要:废话不多说,只讲干货axios的封装请移步到 https://www.cnblogs.com/tlfe/p/11911915.html 挂载在React原型上的时候是这么写的: 在index.js文件中 引入axios文件 import axios from './api/api' React.Co 阅读全文
posted @ 2021-05-11 21:47 龙卷风吹毁停车场 阅读(1606) 评论(0) 推荐(0)
摘要:import React from 'react' import './earnings.scss' import { ListView, PullToRefresh } from 'antd-mobile'; export default class Earnings extends React. 阅读全文
posted @ 2021-05-07 18:59 龙卷风吹毁停车场 阅读(1057) 评论(0) 推荐(0)
摘要:详情可查看github dome 演示文件 https://github.com/fuyunchun/react-redux-demo.git index.js 入口文件 import React from 'react'; import ReactDOM from 'react-dom'; imp 阅读全文
posted @ 2020-11-06 14:26 龙卷风吹毁停车场 阅读(97) 评论(0) 推荐(0)
摘要:只需一步:在package.josn中添加如下代码 "proxy": "http://localhost:8091" 阅读全文
posted @ 2020-11-06 10:12 龙卷风吹毁停车场 阅读(1609) 评论(0) 推荐(0)
摘要:第一步: 安装babel-plugin-transform-decorators-legacy 模块和 @babel/plugin-proposal-decorators 模块 yarn add babel-plugin-transform-decorators-legacy --save-devy 阅读全文
posted @ 2020-11-05 10:25 龙卷风吹毁停车场 阅读(157) 评论(0) 推荐(0)
摘要:这是使用connect装饰器报错, 解决办法, 第一步:安装如下模块 yarn add -D @babel/plugin-proposal-decorators 第二步:配置package.json文件下babel,在babel中添加如下配置 "plugins": [ ["@babel/plugin 阅读全文
posted @ 2020-11-03 21:56 龙卷风吹毁停车场 阅读(1020) 评论(0) 推荐(0)
摘要:第一步:安装sass yarn add sass -D yarn add sass-loader -D 第二步:使用sass import './index.scss' 注意:import './index.sass' 会报错,需要去配置webpack配置文件 阅读全文
posted @ 2020-08-18 10:53 龙卷风吹毁停车场 阅读(772) 评论(0) 推荐(0)
摘要:这是安装element-ui后,运行react后报的错(意思就是说没有找到‘react-hot-loader’这个模块,那我们就装上这个模块) 在控制台中 yarn add react-hot-loader@next --save 再次运行项目 阅读全文
posted @ 2020-04-02 16:29 龙卷风吹毁停车场 阅读(1287) 评论(0) 推荐(0)
摘要:react为我们提供了两种获取value的方法 第一种:非受控方法获取 import React,{Component} from 'react' export default class system extends Component{ constructor(props){ super(pro 阅读全文
posted @ 2020-03-31 10:00 龙卷风吹毁停车场 阅读(1794) 评论(0) 推荐(0)
摘要:来看示例 我在Login自定义组件中引入了自定义组件system import React, { Component } from 'react'; import SYSTEM from './system' export default class Login extends Component{ 阅读全文
posted @ 2020-03-30 18:03 龙卷风吹毁停车场 阅读(590) 评论(0) 推荐(0)
摘要:父组件内 import React, { Component } from 'react'; import SYSTEM from './system' export default class Login extends Component{ constructor(props){ super(p 阅读全文
posted @ 2020-03-27 09:33 龙卷风吹毁停车场 阅读(890) 评论(0) 推荐(0)