UNPKG

mp-colorui

Version:

MP ColorUI 是一款基于 Taro 框架并且联合 Color-UI CSS 库开发的多端 UI 组件库(支持小程序端和H5端)

32 lines (30 loc) 924 B
import Taro from "@tarojs/taro-h5"; import Nerv from "nervjs"; import { View } from "@tarojs/components"; import classNames from "classnames"; export default class ClAnimation extends Taro.Component { render() { const props = this.props; const type = props.type; const reverse = props.reverse ? "animation-reverse" : ""; return <View className={classNames(`animation-${type} ${reverse}`, props.className)} style={Object.assign({ animationDelay: `${props.delay}s`, animationDuration: `${props.duration}s` }, props.style)} onAnimationStart={e => { props.onAnimationStart && props.onAnimationStart(e); }} onAnimationEnd={e => { props.onAnimationEnd && props.onAnimationEnd(e); }}> {this.props.children} </View>; } } ClAnimation.options = { addGlobalClass: true }; ClAnimation.defaultProps = { type: "fade", reverse: false, delay: 0, duration: 0.5 };