import Taro, { Component } from '@tarojs/taro';
import dayjs from 'dayjs'
import './item.scss'

export default class PolicyItem extends Component {

  static defaultProps = {
    data: []
  }
  handleClick() {
    this.props.onClick(this.props.data)
  }
  render() {
    const { data } = this.props
    return (
      <View className="item" key={data.policyId} onClick={this.handleClick}>
        <Image className="item-img" mode="aspectFill" src={data.policyImg}></Image>
        <View className="item-con">
          <View className="item-con__title">{data.title}</View>
          <View className="item-con__date">{dayjs(data.createDate).format('YYYY-MM-DD')}</View>
        </View>
      </View>
    );
  }
}