12345678910111213141516171819202122232425262728293031323334353637 |
- <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: [],
- };
- },
- 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>
|