index.js
572 Bytes
import { Component } from '@tarojs/taro';
import { Image } from '@tarojs/components';
import { getImgUrl } from '../../utils';
import './index.scss';
export default class FormatImage extends Component {
static externalClasses = ['format-img'];
static defaultProps = {
width: 300,
height: 300,
src: ''
}
componentDidMount() {
}
render () {
const {src, width, height, mode} = this.props;
let formatSrc = getImgUrl(src, width, height);
return (
<Image className="format-img" src={formatSrc} mode={mode}></Image>
)
}
}