jd-opensource / jd-opensource/taro-ui
AtImagePicker组件的multiple错误的问题
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
### Taro UI 版本信息
2.2.3
### 问题描述
我要实现一次只能选择一张图片的效果,但是AtImagePicker组件multiple属性失效,不管我把multiple属性设置成true或者是false都可以同时选择多张。
### 复现步骤
手机预览官网上的Demo没问题,可以实现一次只可以选中一张图片,但是自己写的例子就不行。。
### 复现代码
import Taro, { Component } from '@tarojs/taro';
import { View } from '@tarojs/components';
import { observer, inject } from '@tarojs/mobx';
import { AtImagePicker } from 'taro-ui';
import styles from './index.module.less';
@inject('counterStore')
@observer
class ImgUpLoad extends Component {
onChange(files) {
console.log(files);
}
onFail(mes) {
console.log(mes);
}
onImageClick(index, file) {
console.log(index, file);
}
onImageHandle = (index, file) => {
console.log(index, file);
Taro.previewImage({
current: file.url,
urls: [file.url],
});
};
render() {
const { files, length, count, mode, onImageClick, onChange } = this.props;
return (
= count)}
onImageClick={onImageClick}
onChange={onChange}
>
);
}
}
ImgUpLoad.defaultProps = {
files: [],
length: 4,
count: 8,
mode: 'aspectFit',
onImageClick() {},
onChange() {},
};
export default ImgUpLoad;
### 报错信息
无法实现预想效果
### 系统信息
👽 Taro v1.2.26
Taro CLI 1.2.26 environment info:
System:
OS: macOS 10.15
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.11.1 - /usr/local/bin/node
Yarn: 1.19.0 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
npmPackages:
@tarojs/async-await: ^1.3.19 => 1.3.20
@tarojs/components: ^1.3.18 => 1.2.26
@tarojs/mobx: ^1.3.18 => 1.2.26
@tarojs/mobx-h5: ^1.3.18 => 1.2.26
@tarojs/mobx-rn: ^1.3.18 => 1.2.26
@tarojs/plugin-babel: ^1.3.18 => 1.2.26
@tarojs/plugin-csso: ^1.3.18 => 1.2.26
@tarojs/plugin-less: ^1.3.18 => 1.2.26
@tarojs/plugin-sass: ^1.3.20 => 1.3.20
@tarojs/plugin-uglifyjs: ^1.3.18 => 1.2.26
@tarojs/rn-runner: ^1.3.18 => 1.2.26
@tarojs/router: ^1.3.18 => 1.2.26
@tarojs/taro: ^1.3.18 => 1.2.26
@tarojs/taro-alipay: ^1.3.18 => 1.2.26
@tarojs/taro-h5: ^1.3.18 => 1.2.26
@tarojs/taro-swan: ^1.3.18 => 1.2.26
@tarojs/taro-tt: ^1.3.18 => 1.2.26
@tarojs/taro-weapp: ^1.3.18 => 1.2.26
@tarojs/webpack-runner: ^1.3.18 => 1.2.26
eslint-config-taro: ^1.3.18 => 1.2.26
eslint-plugin-taro: ^1.3.18 => 1.2.26
nervjs: ^1.4.0 => 1.5.1
stylelint-taro-rn: ^1.3.18 => 1.2.26
### 补充信息
文档写的太简略了,参数的默认值和可选值都都是空。。-_-||
Contributor guide
Assessment
This issue has not been assessed yet.