import bind from 'bind-decorator' import classnames from 'classnames' import _isFunction from 'lodash/isFunction' import Taro from '@tarojs/taro' import { View, Text, Map } from '@tarojs/components' import * as constant from '../../common/constant' import './index.scss' const MAP: { [key: number]: string } = { [constant.TYPE_PRE_MONTH]: 'pre', [constant.TYPE_NOW_MONTH]: 'now', [constant.TYPE_NEXT_MONTH]: 'next' } export interface Props { list: List onClick?: (item: Item) => void onLongClick?: (item: Item) => void } export default class AtCalendarList extends Taro.Component { @bind private handleClick (item) { if (_isFunction(this.props.onClick)) { this.props.onClick(item) } } @bind private handleLongClick (item) { if (_isFunction(this.props.onLongClick)) { this.props.onLongClick(item) } } render () { const { list } = this.props if (!list || list.length === 0) return null return ( {list.map((item, index) => ( {item.text} {item.marks && item.marks.length > 0 ? ( {item.marks.map((mark, key) => ( ))} ) : null} ))} ) } }