|
@@ -11,7 +11,7 @@
|
|
<image class="add" src="../../static/me/icon_add.png" mode="widthFix" />
|
|
<image class="add" src="../../static/me/icon_add.png" mode="widthFix" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view class="tips">*最多上传5张图片</view>
|
|
|
|
|
|
+ <view class="tips">*最多上传{{maxImageCount}}张图片</view>
|
|
|
|
|
|
<view class="blankHeight"></view>
|
|
<view class="blankHeight"></view>
|
|
</view>
|
|
</view>
|
|
@@ -25,6 +25,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { isArray } from '../../uni_modules/cl-uni/utils';
|
|
export default {
|
|
export default {
|
|
components: {},
|
|
components: {},
|
|
data() {
|
|
data() {
|
|
@@ -35,6 +36,7 @@
|
|
'xx', 'ff', 'vv'
|
|
'xx', 'ff', 'vv'
|
|
],
|
|
],
|
|
list: [],
|
|
list: [],
|
|
|
|
+ maxImageCount:5
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
@@ -134,15 +136,16 @@
|
|
upload() {
|
|
upload() {
|
|
console.log("----upload");
|
|
console.log("----upload");
|
|
var that = this;
|
|
var that = this;
|
|
- if (this.list.length >= 5) {
|
|
|
|
|
|
+ if (this.list.length >= this.maxImageCount) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: "最多上传5张图片",
|
|
title: "最多上传5张图片",
|
|
icon: 'none'
|
|
icon: 'none'
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ let count = this.maxImageCount - this.list.length
|
|
uni.chooseImage({
|
|
uni.chooseImage({
|
|
- count: 5,
|
|
|
|
|
|
+ count,
|
|
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ['album', 'camera'], //从相册、相机选择
|
|
sourceType: ['album', 'camera'], //从相册、相机选择
|
|
extension: ['.png', '.jpeg', '.jpg'],
|
|
extension: ['.png', '.jpeg', '.jpg'],
|