xcandy
Version:
A UI framework for taro.js
32 lines (31 loc) • 869 B
JavaScript
import { Component } from "@tarojs/taro-h5";
import Nerv from "nervjs";
import { View } from '@tarojs/components';
import classnames from 'classnames';
import './index.scss';
class XcMask extends Component {
constructor() {
super(...arguments);
}
render() {
const { show } = this.props;
const maskClassNames = classnames('xc-mask', {
'xc-mask--show': show
});
const maskInterlayerClassNames = classnames('xc-mask__interlayer', {
'xc-mask__interlayer--show': show
});
return <View className={maskClassNames}>
<View className={maskInterlayerClassNames} onClick={this.handleMaskClick} />
{this.props.children}
</View>;
}
handleMaskClick = () => {
const { onClickMask } = this.props;
onClickMask && onClickMask();
};
}
XcMask.defaultProps = {
show: false
};
export default XcMask;