mini-check
Version:
27 lines (23 loc) • 871 B
JavaScript
import Taro from "@tarojs/taro-h5";
import Nerv from "nervjs";
import { Text, View, Image } from '@tarojs/components';
import classnames from 'classnames';
import checkedImg from '../../../assets/checked.png';
import checkImg from '../../../assets/check.png';
import './index.scss';
class CheckBoxListItem extends Taro.Component {
render() {
const {
children: children
} = this.props;
const { compStyle, checked, onClick, className } = this.props;
const cls = classnames(className ? ['item-wrap', className] : 'item-wrap');
return <View className={cls} onClick={onClick}>
{checked ? <Image src={checkedImg} className="check-img" /> : <Image src={checkImg} className="check-img" />}
<Text style={compStyle} className={classnames('item-text')}>
{children}
</Text>
</View>;
}
}
export default CheckBoxListItem;