defaultProps
import { string, object } from 'prop-types'
//设置默认值
static defaultProps = {
model:{
id: 0
},
title: 'zbx'
}
使用基于类的组件时,当你将方法传递给组件时,你必须保证方法在调用时具有正确的上下文 this。常见的方法是,通过将 this.handleSubmit.bind(this) 传递给子组件来实现。
defaultProps
import { string, object } from 'prop-types'
//设置默认值
static defaultProps = {
model:{
id: 0
},
title: 'zbx'
}
使用基于类的组件时,当你将方法传递给组件时,你必须保证方法在调用时具有正确的上下文 this。常见的方法是,通过将 this.handleSubmit.bind(this) 传递给子组件来实现。
转载于:https://my.oschina.net/zhubaoxin/blog/2988566