<template>
	<view>
		<view class="form-item">
			<view class="label">上传图片</view>
			<view>{{imgList.length}}/{{number}}</view>
		</view>
		<view class="upload-box">
			<shmily-drag-image :number="number" v-model="imgList"></shmily-drag-image>
		</view>
	</view>
</template>

<script>
	export default {
		components: {
			
		},
		props: {
			number: {
			  type: Number,
			  default: 6
			},
			modelValue: {
			  type: Array,
			  default: []
			},
		},
		data() {
			return {
				imgList: [],
			}
		},
		created() {
			this.imgList = this.modelValue;
		},
		computed: {
			
		},
		watch: {
			imgList: {
				handler: function(newVal, oldVal) {
					this.$emit('update:modelValue', newVal); 
				}
			},
			modelValue: {
				handler: function(newVal, oldVal) {
					this.imgList = newVal;
				}
			},
		},
		methods: {
			
		}
	}
</script>

<style lang="scss" scoped>
	.form-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 15px;
		
		.label {
			font-size: 30rpx;
			min-width: 200rpx;
		}
	}
	
	.upload-box {
		padding: 15px;
	}
</style>