摘要: 1.将数据渲染到页面中 创建一个.jsx文件 import React from 'react' export default class MyInput extends React.Component{ constructor(){ super() this.state={ msg:'123' } 阅读全文
posted @ 2020-02-16 20:31 程序员徐小白 阅读(220) 评论(0) 推荐(0)
摘要: 1.定义组件 新建一个.jsx文件 import React from 'react' export default class MyBtn extends React.Component{ constructor(){ super() this.state={ msg:'123' } } rend 阅读全文
posted @ 2020-02-16 19:16 程序员徐小白 阅读(86) 评论(0) 推荐(0)
摘要: 1.给组件绑定事件 创建组件,并绑定方法 创建一个.jsx文件 import React from 'react' export default class MyBtn extends React.Component{ constructor(){ super() this.state={ } } 阅读全文
posted @ 2020-02-16 18:52 程序员徐小白 阅读(181) 评论(0) 推荐(0)
摘要: 第一组情景: //setTimeout的第一个参数是一个函数 setTimeout(function(){console.log('这是一个普通函数'+this)},1000) setTimeout(()=>{console.log('这是一个箭头函数'+this)},1000) 输出的结果为: 这 阅读全文
posted @ 2020-02-16 18:39 程序员徐小白 阅读(63) 评论(0) 推荐(0)
摘要: 1.行内样式 class 组件名称 extends React.Component{ render(){ return <div style={{color:'red',border: '1px'}}></div> } } 样式值为字符串类型时,需要用单引号包裹 使用双花括号包裹样式 !!!可以将内 阅读全文
posted @ 2020-02-16 14:17 程序员徐小白 阅读(117) 评论(0) 推荐(0)