2020年7月4日
摘要: 一、使用setState现象 1.不可变值 class StateDemo extends React.Component { constructor(props) { super(props) this.state = { count: 0 } } render() { return <div> 阅读全文
posted @ 2020-07-04 19:42 猪mother 阅读(1269) 评论(1) 推荐(1) 编辑
摘要: 1.react父子组件之间通过props传递数据,通过callback回调子组件向父组件通信, 我们看下面的伪代码: class TodoListDemo extends React.Component { constructor(props) { super(props) // 状态(数据)提升 阅读全文
posted @ 2020-07-04 19:21 猪mother 阅读(205) 评论(0) 推荐(0) 编辑
摘要: class EventDemo extends React.Component { constructor(props) { super(props) this.state = { name: 'zhangsan', } // 修改方法的 this 指向 this.clickHandler1 = t 阅读全文
posted @ 2020-07-04 18:56 猪mother 阅读(612) 评论(0) 推荐(0) 编辑
摘要: 1.JSX的使用 class JSXBaseDemo extends React.Component { constructor(props) { super(props) this.state = { name: 'xiaoming', imgUrl: 'https://img1.mukewang 阅读全文
posted @ 2020-07-04 18:44 猪mother 阅读(196) 评论(0) 推荐(0) 编辑
  2020年7月3日
摘要: <!-- 理解原型 --> <script> function Person(name){ this.name=name } Person.prototype.age=10 var person1 = new Person() var person2 = new Person() console.l 阅读全文
posted @ 2020-07-03 15:40 猪mother 阅读(182) 评论(0) 推荐(0) 编辑
摘要: <!-- 函数的重要性 --> <script> // <1>函数是第一类对象:javascrip中函数拥有对象的所有能力 //对象能做的任何一件事,函数都能做 //函数的特别之处在于它是可调用的,可以被调用来执行某项操作 // 1.函数的创建方式 //(1)通过字面量创建 function foo 阅读全文
posted @ 2020-07-03 14:53 猪mother 阅读(236) 评论(0) 推荐(0) 编辑
  2020年6月3日
摘要: 1.变量声明的方式:let const 2.模板字符串:反引号`` 3.函数里面:箭头函数,传参的时候使用默认参数, 4.解构,剩余参数的使用 5.展开运算符 6.class 7.promise 8.export/import 阅读全文
posted @ 2020-06-03 08:10 猪mother 阅读(199) 评论(0) 推荐(0) 编辑
  2020年5月29日
摘要: https://segmentfault.com/a/1190000014175918?utm_source=tag-newest var arr=[2,34,54,66,43,20,20] var m=0; var n=0; for(var i=0;i<arr.length-1;i++){ for 阅读全文
posted @ 2020-05-29 20:38 猪mother 阅读(99) 评论(0) 推荐(0) 编辑
摘要: // var let const 区别 // ES5 只有全局作用域和函数作用域,没有块级作用域,这带来很多不合理的场景, <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>var</title> <scrip 阅读全文
posted @ 2020-05-29 17:36 猪mother 阅读(155) 评论(0) 推荐(0) 编辑
摘要: // 1.0数据类型有几种 // 值类型(基本数据类型):String Number Boolean undefined Symbol // 引用数据类型:Object Function Array null // 2.0typeof输出什么 可以设别所有的值类型 console.log(typeo 阅读全文
posted @ 2020-05-29 16:47 猪mother 阅读(179) 评论(0) 推荐(0) 编辑