import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
// import { fromJS } from 'immutable'
|
import { Col, Row } from 'antd'
|
|
import './index.scss'
|
|
|
class CheckCard extends Component {
|
static propTpyes = {
|
multiple: PropTypes.bool, // 是否可多选
|
width: PropTypes.number, // 宽度
|
display: PropTypes.string, // 显示为:text(文本)、picture(图片)
|
fields: PropTypes.array, // 字段集
|
options: PropTypes.array, // 数据列表
|
onChange: PropTypes.func, // 数据切换
|
}
|
|
state = {
|
selectKeys: null, // 选中数据id
|
}
|
|
UNSAFE_componentWillMount () {
|
|
}
|
|
UNSAFE_componentWillReceiveProps (nextProps) {
|
|
}
|
|
getCards = () => {
|
const { display, options, fields } = this.props
|
if (display === 'picture') {
|
return options.map(item => {
|
<Col>
|
<div>
|
{fields.map(col => {
|
return <span></span>
|
})}
|
</div>
|
</Col>
|
})
|
} else {
|
return <Col></Col>
|
}
|
}
|
|
render() {
|
|
return (
|
<Row gutter={24}>{this.getCards()}</Row>
|
)
|
}
|
}
|
|
export default CheckCard
|