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