随笔分类 -  react

摘要:// html: data(){ selectData: { defaultIndex: 0,//默认选中是第几个 selectStatus: false,//通过这个来控制下拉框的显示和隐藏 selectOptions: []//下拉框中的数据 }, } onChange... 阅读全文
posted @ 2019-06-01 18:27 Panax 阅读(973) 评论(0) 推荐(0) 编辑
摘要:React生命周期 react周期钩子通常是由三四个单词组合而成,对于英语不好的伙伴是不是很头大,不要急,记下下面三个状态,知道will,do ,哈哈,就是这样~ React 生命周期分为三种状态: 初始化 更新 销毁 1.初始化 设置默认的props,也可以用dufaultProps设置组件的默认 阅读全文
posted @ 2019-03-19 11:48 Panax 阅读(163) 评论(0) 推荐(0) 编辑
摘要:ComponentWillMount 编译前。渲染前调用 componentDidMount 编译完成,渲染后调用 componentWillUpdate 组件state调用后将要更新时,但还没有render调用 componentDidUpdate 在组件完成更新后立即被调用 componentW 阅读全文
posted @ 2019-03-19 11:02 Panax 阅读(549) 评论(0) 推荐(0) 编辑
摘要:你可能在Link to没写state {{pathname:'/report',state:{storageClear:this.state.storageClear}}} 阅读全文
posted @ 2018-07-25 18:24 Panax 阅读(1673) 评论(0) 推荐(0) 编辑
摘要:1.引入插件 import ReactSwipes from 'react swipes'; import './swiperCard.css'; 2.代码构成 export default class SwiperCard extends Component { constructor(props 阅读全文
posted @ 2018-07-25 18:15 Panax 阅读(784) 评论(0) 推荐(0) 编辑
摘要:废话不说,直接贴代码,供新手参考 <!DOCTYPE html export default class TabComponent extends Component { constructor(props){ super(props); this.state = { }; } render(){ 阅读全文
posted @ 2018-06-28 18:10 Panax 阅读(512) 评论(0) 推荐(0) 编辑
摘要:倒计时组件 import React, { Component } from 'react' import $ from 'jquery' import "../../css/spellTEPayPublic/countDown.css" export default class countDown 阅读全文
posted @ 2018-05-13 00:21 Panax 阅读(6271) 评论(0) 推荐(1) 编辑
摘要:如果每次启动都有一大串的no unused vars 是不是感觉特别烦,不用担心啦,有个配置可以解决它; 1. 在Hbuild 里面可以新建一个 .eslintrc 其他文件(伤心的是我在webStorm 和其他编辑器都建不起来,提示必须输文件名); 2. 就是npm run eject (暴露re 阅读全文
posted @ 2018-04-27 10:46 Panax 阅读(7536) 评论(3) 推荐(1) 编辑
摘要:js 有时在定义变量的类型为number 或string 时并不会报错,所以prop types 是专门用来检测react ,以前的版本是把它放到react架构里面 ,现在作为一个独立的库搬出来了,跟redux 一样; 1.首先你需要通过在终端npm install prop types save 阅读全文
posted @ 2018-04-26 12:32 Panax 阅读(220) 评论(0) 推荐(0) 编辑
摘要:1. 首先引入插件 import ReactPullLoad, {STATS} from 'react pullload' 2. 初始化: constructor(props) { super(props); this.state = { action: STATS.init, hasMore: t 阅读全文
posted @ 2018-03-05 19:32 Panax 阅读(12198) 评论(0) 推荐(1) 编辑
摘要:react 组件渲染分为初始化渲染和更新渲染,当我们更新某个组件的时候,只是想关键路径上组件的render,但react的默认做法是调用所以组件的reder,再生成虚拟dom进行对比,如不变则不进行更新。这样的render和虚拟DOM的对比明显是在浪费。 React的优化是基于shouldCompo 阅读全文
posted @ 2018-02-26 15:14 Panax 阅读(360) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示