
react-system
react学习
梦灯
计算机软件很有趣,我很喜欢。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
react-01 npm/yarn and git
1 preparation of npm/yarn //设置淘宝镜像 npm config set registry https://registry.npm.taobao.org yarn config set registry https://registry.npm.taobao.org //初始化项目 npm init -y yarn init -y //下载项目的所...原创 2019-08-07 09:42:24 · 149 阅读 · 0 评论 -
react-08-05 优化登录功能
1.Login.jsx 将用户信息保存到内存中 import memoryUtils from '../../utils/memoryUtils' const result =await reqLogin(username,password) //const result = response.data //{status:0,data: user} {status:1,mes...原创 2019-08-16 16:13:36 · 212 阅读 · 0 评论 -
react-08-04 实现简单登录功能
1.Login.jsx 直接获取数据 const result =await reqLogin(username,password) //const result = response.data //{status:0,data: user} {status:1,message: 'xxx'} if (result === 0){ //登录成功 //提示成功 m...原创 2019-08-16 16:13:29 · 849 阅读 · 0 评论 -
react-08-03 统一处理请求异常
1.api/ajax.js /* * 能发送异步Ajax请求的函数模块 * 封装axios库:github获取 * 函数的返回值是promise对象 * 1.优化:统一处理请求异常 * 在外层包一个自己创建的promise对象 * 在请求出错时,步reject(error),而是显示错误信息 * */ import axios from 'axios' import {message...原创 2019-08-16 16:13:22 · 951 阅读 · 0 评论 -
react-08-02 await 和 async
1描述 /* * async和await * 1)作用? * 简化promise对象的使用:不再使用then()来指定成功/失败的回调函数,以同步编码(没有回调函数了)方式实现异步流程 * 2)哪里写await? * 在返回promise的表达式左侧写await:不想要promise,而是promise异步执行的成功的value数据 * 3)哪里写async? * await所在函...原创 2019-08-16 16:13:13 · 350 阅读 · 1 评论 -
react-08-01 ajax
1 下载依赖 cnpm install axios –save //yarn add axios 2 封装ajax请求 1 api/ajax.js /* * 能发送异步Ajax请求的函数模块 * 封装axios库:github获取 * 函数的返回值是promise对象 * */ import axios from 'axios' export default function aj...原创 2019-08-16 16:13:05 · 147 阅读 · 0 评论 -
react-07-4 Login Form表单验证
用户名/密码的合法性要求: 1).必须输入 2).必须大于4位 3).必须小于12位 4).必须是英文,数字或下划线组成 1 申明式验证 以用户名为例 {getFieldDecorator('username',{ //配置对象:属性名是特定的一些名称 //申明式验证:直接使用别人定义好的验证规则进行验证 rules:[ { requi...原创 2019-08-16 16:12:57 · 680 阅读 · 0 评论 -
react-07-3 Login Form收集表单数据
在react-07-2 Login Form基础上修改Login.jsx import React,{Component} from 'react' import {Form,Icon,Input,Button} from 'antd' import './login.less' import logo from './images/logo.png' /*登录的路由组件*/ class L...原创 2019-08-16 16:12:50 · 455 阅读 · 0 评论 -
react-07-2 Login Form
在react-07-1 Login Layout的基础上修改代码: 1 Login.jsx import React,{Component} from 'react' import {Form,Icon,Input,Button} from 'antd' import './login.less' import logo from './images/logo.png' /*登录的路由组件...原创 2019-08-16 16:12:41 · 291 阅读 · 0 评论 -
react-07-1 Login Layout
1 目录结构 2 引入全局样式reset.css /*! minireset.css v0.0.5 | MIT License | github.com/jgthms/minireset.css */ html, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, if...原创 2019-08-16 16:12:24 · 295 阅读 · 0 评论 -
react-06 using router
1 框架 2 下载路由依赖 cnpm install react-router-dom –save //yarn add react-router-dom 3 路由组件 3.1login组件 import React,{Component} from 'react' /*登录的路由组件*/ export default class Login extends Componen...原创 2019-08-07 12:58:46 · 132 阅读 · 0 评论 -
react-05 definite theme
1 官网 自定义antd主题:https://ant.design/docs/react/customize-theme-cn 2 下载工具包 cnpm install less less-loader –save //yarn add less less-loader 3 修改config-overrides.js文件 const {override,fixBabelI...原创 2019-08-07 12:24:48 · 117 阅读 · 0 评论 -
react-04 Using Antd
1下载antd cnpm install antd --save 2 引入Antd(App.js) 在此处引用不会起作用,需要在index.js中引入全局样式才能起作用 /* 应用的根组件 * */ import React,{Component} from 'react' import {Button,message} from 'antd' export default ...原创 2019-08-07 11:45:18 · 181 阅读 · 0 评论 -
react-03 first case
1 目录结构 2 index.js /* 应用的入口组件:作用是渲染组件 * */ import React from 'react' import ReactDOM from 'react-dom' import App from './App' //将App组件标签渲染到index页面的div上 ReactDOM .render(<App/>,do...原创 2019-08-07 10:51:40 · 161 阅读 · 0 评论 -
react-02 Project Development
1 Using create-react-app to build project npm install -g create-react-app //全局下载工具 create-react-app react-admin //下载模板项目 cd react-admin //进入到文件夹 npm start //运行项目 访问:localhost:3000 2 Ba...原创 2019-08-07 10:05:32 · 123 阅读 · 0 评论 -
react-08-06 维持登录与自动登录
描述: 登录后,刷新后依然处于登录状态(维持登录) 登录后,关闭浏览器后打开浏览器访问依然是已经登录状态(自动登录) 登录后,访问登录路径自动跳转到管理界面 1.下载依赖 cnpm install store --save 2.utils/storageUtils.js /* * 进行local数据存储管理的工具模块 * */ import store from 'store' c...原创 2019-08-16 16:12:06 · 1102 阅读 · 0 评论