摘要: https://reacttraining.com/react-router/web/example/basic // git 实例地址 1.安装 npm install react-router-dom --save 2.引入 import { BrowserRouter as Router, R 阅读全文
posted @ 2019-07-04 15:11 陈小作 阅读(7976) 评论(0) 推荐(0) 编辑
摘要: import React from 'react' class LifeCycle extends React.Component{ constructor(props) { console.log('我是constructor') super(props) this.state = { value: '生命周期组件... 阅读全文
posted @ 2019-07-04 12:56 陈小作 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 垂直居中:align-items:center; display: -webkit-flex;水平居中:justify-content:center; display: -webkit-flex; 阅读全文
posted @ 2019-07-03 17:32 陈小作 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 父组件 子组件 阅读全文
posted @ 2019-07-03 15:18 陈小作 阅读(2138) 评论(0) 推荐(0) 编辑
摘要: import React from 'react' class TodeList extends React.Component { constructor(props) { super(props) this.state = { hasDoneList: ['看书', '跑步', '仰卧起坐', '俯卧撑'], // 已经做了的... 阅读全文
posted @ 2019-07-02 20:16 陈小作 阅读(505) 评论(0) 推荐(0) 编辑
摘要: import React, {Component} from 'react'; class Home extends Component { constructor(props) { super(props) this.state = { value: '' } this.input = React... 阅读全文
posted @ 2019-06-29 17:22 陈小作 阅读(4261) 评论(1) 推荐(1) 编辑
摘要: import React from 'react' class Home extends React.Component{ constructor(props){ super(props) this.state = { msg: 'Home组件中的数据' } this.getMessage = th... 阅读全文
posted @ 2019-06-25 17:26 陈小作 阅读(937) 评论(0) 推荐(0) 编辑
摘要: import React from 'react' import img from '../public/img/001.jpg' // 此时img是一个变量,在下面直接使用该变量即可引入该图片 class New extends React.Component{ constructor(props) { super(props) this.state =... 阅读全文
posted @ 2019-06-25 16:07 陈小作 阅读(1838) 评论(0) 推荐(0) 编辑
摘要: let fd = new FormData() // 定义传递的序列化对象,for (let i = 0; i < addArr.length; i++) { // addArr是选中文件的输入框中的e.target.files fd.append(addArr[i].name + "", addArr[i]) //通过append()将键名和值放进去 } 此时将上传的文件序列化后,如果还... 阅读全文
posted @ 2019-06-18 14:57 陈小作 阅读(1000) 评论(0) 推荐(0) 编辑
摘要: 组件基本使用import React, { Component } from 'react'; // 在组件头部引用class Home extends Component { // 创建类 render(){ // 将页面通过return返回给调用者 必须有一个根节点包裹 同vue的使用 retu 阅读全文
posted @ 2019-06-17 22:03 陈小作 阅读(1402) 评论(0) 推荐(0) 编辑