weixin_44206231
Houmior
2019-01-22 11:24

上传图片完成时 下次上传上次的图片还会显示出来 怎么清空

  • vue.js
 <el-form ref="form" :model="form" :rules="rules" size="small" label-width="90px">
       <el-upload
        class="avatar-uploader"
        action='http://192.168.1.143:8090/consulting-file/file/tempSaveFile'
        name="multipartFile"
        :show-file-list="false"
        v-model="form.file.fileId"
        :on-success="handleAvatarSuccess"
        :before-upload="beforeAvatarUpload">
        <img v-if="imageUrl" :src="imageUrl" class="avatar">
        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
       </el-upload>
``` doSubmit() {

      this.$refs['form'].validate((valid) => {

        if (valid) {
          this.loading = true
          /* this.form.roles = [] */
          const _this = this

           commit(this.form.file.fileId).then(res => {
             add(this.form).then(res => {

              this.resetForm()
              this.$notify({
                title: '添加成功',
                type: 'success',
                duration: 2500,

              })

              this.loading = false
              this.$parent.$parent.init()

            }).catch(err => {
              this.loading = false
              console.log(err.response.data.message)
            })
          }).catch(err => {
            this.loading = false
            console.log(err.response.data.message)
          })

         /* this.roleIds.forEach(function(data, index) {
            const role = { id: data }
            _this.form.roles.push(role)
          }) */
           /* this.form.accountNumber.password = md5(this.form.accountNumber.password)  */

        } else {
          return false
        }
      })
    },
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答