<template>
	<view class="content">
		<view class="one">
			<upload :list="file" name="file" :count="6" @uplSuc="uplSuc" @uplDel="uplDel"></upload>
		</view>
	</view>
</template>

<script>
	import upload from "@/components/upload/index.vue";
	export default {
		components: {
			upload,
		},
		data() {
			return {
				file: [],
			};
		},
		onLoad() {},
		methods: {
			// 图片上传
			uplSuc(e) {
				const that = this;
				that.$set(that, `${e.name}`, [...that[e.name], e.data]);
			},
			// 图片删除
			uplDel(e) {
				const that = this;
				let data = that[e.name];
				let arr = data.filter((i, index) => index != e.data.index);
				that.$set(that, `${e.name}`, arr);
			},

		},
	};
</script>

<style lang="scss"></style>
