mp-colorui
Version:
MP ColorUI 是一款基于 Taro 框架并且联合 Color-UI CSS 库开发的多端 UI 组件库(支持小程序端和H5端)
30 lines (28 loc) • 936 B
JavaScript
import Taro from "@tarojs/taro-h5";
import Nerv from "nervjs";
import { View } from "@tarojs/components";
import { TEXT_COLOR_LIST, SIZE } from "../../lib/model";
import ClLayout from "../layout/index";
import { classNames } from "../../lib/index";
export default class ClDivider extends Taro.Component {
render() {
const props = this.props;
const { color, size } = props;
const colorClassName = TEXT_COLOR_LIST[color || "grey"];
const sizeClassName = `text-${SIZE[size || "normal"]}`;
return <View className={classNames(props.className)} style={Object.assign({}, props.style)}>
<ClLayout padding="normal" paddingDirection="vertical">
<View className={`${colorClassName} ${sizeClassName} cu-divider`}>
{this.props.children}
</View>
</ClLayout>
</View>;
}
}
ClDivider.options = {
addGlobalClass: true
};
ClDivider.defaultProps = {
color: "grey",
size: "normal"
};