UNPKG

antd-mobile-taro-ui

Version:

以antd-mobile为设计标准,基于taro框架的微信小程序组件库

18 lines 613 B
import React from 'react'; import { withNativeProps } from 'antd-mobile/es/utils/native-props'; import { Image } from '@tarojs/components'; import { mergeProps } from 'antd-mobile/es/utils/with-default-props'; import classNames from 'classnames'; const classPrefix = 'adm-avatar'; const defaultProps = { module: 'scaleToFill' }; export const Avatar = p => { const props = mergeProps(defaultProps, p); return withNativeProps(props, React.createElement(Image, { className: classNames(classPrefix, { [`${classPrefix}-fallback`]: !props.src }), src: props.src || props.fallback || '' })); };