Переглянути джерело

图片上传功能bug修复-删除按钮判断问题

wuhao 3 роки тому
батько
коміт
c407a96ee3
1 змінених файлів з 6 додано та 5 видалено
  1. 6 5
      src/components/Upload/index.vue

+ 6 - 5
src/components/Upload/index.vue

@@ -7,7 +7,7 @@
     </el-upload>
     <div class="upload-img" v-else>
       <el-image :src="newUrl" />
-      <span v-if="hideDelete" class="upload-btn">
+      <span v-if="disabled === false" class="upload-btn">
         <i class="el-icon-delete" @click="handleRemove" />
       </span>
     </div>
@@ -22,6 +22,11 @@ export default {
     url: {
       type: String,
       default: ''
+    },
+    // 隐藏删除按钮
+    disabled:{
+      type: Boolean,
+      default: true
     }
   },
   data() {
@@ -36,8 +41,6 @@ export default {
       action: process.env.VUE_APP_BASE_API + "/system/file/picture/upload",
       // 隐藏上传按钮
       hideUpload: true,
-      // 隐藏删除按钮
-      hideDelete: true,
       // 图片
       newUrl: ''
     }
@@ -47,7 +50,6 @@ export default {
       if (val) {
         this.newUrl = val
         this.hideUpload = false
-        this.hideDelete = false
       }
     }
   },
@@ -55,7 +57,6 @@ export default {
     if (this.url) {
       this.newUrl = this.url
       this.hideUpload = false
-      this.hideDelete = false
     }
   },
   methods: {