摘要: 实现js跳转路由: /* 实现js跳转路由:https://reacttraining.com/react-router/web/example/auth-workflow 1、要引入Redirect import { BrowserRouter as Router, Route, Link, Redirect, withRouter ... 阅读全文
posted @ 2019-06-10 11:31 安之&若素 阅读(2354) 评论(0) 推荐(0) 编辑
摘要: React路由配置 菜品列表二维数组渲染 跳转详情传值 阅读全文
posted @ 2019-06-10 11:30 安之&若素 阅读(1834) 评论(0) 推荐(1) 编辑
摘要: /* react路由的配置: 1、找到官方文档 https://reacttraining.com/react-router/web/example/basic 2、安装 cnpm install react-router-dom --save 3、找到项目的根组件引入react-router-dom import { BrowserRout... 阅读全文
posted @ 2019-06-10 11:25 安之&若素 阅读(2658) 评论(0) 推荐(0) 编辑
摘要: /* https://reactjs.org/docs/react-component.html React生命周期函数: 组件加载之前,组件加载完成,以及组件更新数据,组件销毁。 触发的一系列的方法 ,这就是组件的生命周期函数 组件加载的时候触发的函数: constructor 、componentWillMount、 render 、component... 阅读全文
posted @ 2019-06-10 11:17 安之&若素 阅读(4789) 评论(0) 推荐(0) 编辑
摘要: 方式一:Axios获取服务器数据: 方式二:FetchJsonp获取服务器数据: import React, { Component } from 'react'; import fetchJsonp from 'fetch-jsonp'; class FetchJsonp extends Comp 阅读全文
posted @ 2019-06-10 11:14 安之&若素 阅读(2334) 评论(0) 推荐(0) 编辑
摘要: /* React中的组件: 解决html 标签构建应用的不足。 使用组件的好处:把公共的功能单独抽离成一个文件作为一个组件,哪里里使用哪里引入。 父子组件:组件的相互调用中,我们把调用者称为父组件,被调用者称为子组件 父子组件传值(react 父子组件通信): 父组件给子组件传值 1.在调用子组件的时候定义一个属性 ... 阅读全文
posted @ 2019-06-10 11:11 安之&若素 阅读(360) 评论(0) 推荐(0) 编辑
摘要: import React,{Component} from 'react'; import '../assets/css/index.css'; //引入自定义模块 import storage from '../model/storage'; class Todolist extends Component { constructor(props) { super... 阅读全文
posted @ 2019-06-10 11:03 安之&若素 阅读(571) 评论(0) 推荐(0) 编辑
摘要: import React, { Component } from 'react'; class ReactForm extends Component { constructor(props) { super(props); this.state = { msg:"react表单", name:'' 阅读全文
posted @ 2019-06-10 10:56 安之&若素 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 键盘事件: 双向数据绑定: 阅读全文
posted @ 2019-06-10 10:37 安之&若素 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 在以类继承的方式定义的组件中,为了能方便地调用当前组件的其他成员方法或属性(如:this.state),通常需要将事件处理函数运行时的 this 指向当前组件实例。 绑定事件处理函数this的几种方法: 第一种方法: run(){ alert(this.state.name) } <button o 阅读全文
posted @ 2019-06-10 10:32 安之&若素 阅读(452) 评论(0) 推荐(0) 编辑
摘要: super关键字: 参考:http://www.phonegap100.com/thread-4911-1-1.html Es6中的super可以用在类的继承中,super关键字,它指代父类的实例(即父类的this对象)。子类必须在constructor方法中调用super方法,否则新建实例时会报错 阅读全文
posted @ 2019-06-10 10:30 安之&若素 阅读(199) 评论(0) 推荐(0) 编辑
摘要: React的介绍: React来自于Facebook公司的开源项目 React 可以开发单页面应用 spa(单页面应用) react 组件化模块化 开发模式 React通过对DOM的模拟(虚拟dom),最大限度地减少与DOM的交互 (数据绑定) react灵活 React可以与已知的库或框架很好地配 阅读全文
posted @ 2019-06-10 10:25 安之&若素 阅读(1186) 评论(0) 推荐(0) 编辑