How to implement it in iview? click the button and start uploading attachments.

1. Use the upload component in iview. After selecting the file, click the upload button to start uploading the upload api document of
2.iview.

the hook before before-upload uploads the file. The parameter is the uploaded file. If false or Promise is returned, the upload will be stopped

so my idea is to return a promise object in the before-upload callback function. After clicking upload, execute the resolve method of promise, so that you can upload after clicking.

< H2 > the current problem is, click the "upload" button, how to execute the resolve method of Promise, and how to implement it in vue < / H2 >.
upload(rawFile, file) {
  this.$refs.input.value = null;
  if (!this.beforeUpload) {
    return this.post(rawFile);
  }
  const before = this.beforeUpload(rawFile);
  if (before && before.then) {
    before.then(processedFile => {
      if (Object.prototype.toString.call(processedFile) === "[object File]") {
        this.post(processedFile);
      } else {
        this.post(rawFile);
      }
    }, () => {
      this.onRemove(null, rawFile);
    });
  } else if (before !== false) {
    this.post(rawFile);
  } else {
    this.onRemove(null, rawFile);
  }
},

https://github.com/oyv1cent/i.

is not based on promise, but you can refer to

.

you can store the returned promise in a data and pass it to the button click event through the click parameter.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7b4091-16246.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7b4091-16246.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?