摘要: 1.实用目的: 在组件中,如果一个组件的某一个功能需要重复实用,那么就可以使用 render props方法。 2.步骤: 1) 创建某个组件,在组件中提供复用的状态(1.状态 2.修改状态的方法) 1.状态 this.state = { x:0, y:0 } 2. 修改方式 mouseXY=e=> 阅读全文
posted @ 2020-03-27 00:06 流年碎 阅读(522) 评论(0) 推荐(0) 编辑
摘要: 1、 项目中在android/app/src/main/创建文件夹 assets 2、项目中执行命令 1、 项目中在android/app/src/main/创建文件夹 assets 2、项目中执行命令 react-native bundle --platform android --dev fal 阅读全文
posted @ 2020-01-13 10:20 流年碎 阅读(572) 评论(0) 推荐(0) 编辑
摘要: 警告 : Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel 阅读全文
posted @ 2019-07-18 16:55 流年碎 阅读(1174) 评论(0) 推荐(0) 编辑
摘要: 1. color js写法: react 写法 样式暂时未知怎么修改 阅读全文
posted @ 2019-07-11 17:22 流年碎 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 1.为什么会出现 prototype 这个关键字 使用构造函数创建对象 不是共享的 浪费内存 例子: 2.使用的意义 1)节省内存,通过原型分配的函数是 共享的 2)每个构造函数都有一个 prototype 3. 使用方法(把不变的方法直接定义到prototype 上实现共享 ) (公共属性定义到构 阅读全文
posted @ 2019-07-10 23:14 流年碎 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 构造函数 的静态成员和实例成员 实例成员 就是构造函数内部通过thist添加的属性和方法(成员) 如 name,age,sing。实例成员只能通过实例化的对象来访问 如 lx.name li.sing() 正确的访问 Demo.name 错误的访问 静态成员 在构造函数本身上添加的成员 如 访问: 阅读全文
posted @ 2019-07-10 22:26 流年碎 阅读(162) 评论(0) 推荐(0) 编辑
摘要: function Demo(name,age){ this.name = name this.age = age this.sing = function(){ console.log(this.name + "唱歌") } } let lx = new Demo('张三',10) lx.sing() 阅读全文
posted @ 2019-07-10 22:16 流年碎 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 1.在内存中创建一个空对象 2.让this 指向这个新对象 3.执行构造函数里面的代码,给这个对象添加属性和方法 4.返回这个新对象(构造函数不需要return) 阅读全文
posted @ 2019-07-10 22:07 流年碎 阅读(1318) 评论(0) 推荐(0) 编辑