About the upload component of element-ui

 <el-upload
    :action="https://up-z2.qiniup.com"
    :data="postData"
    :before-upload="beforeUpload"
    list-type="picture-card">
    <i class="el-icon-plus" />
</el-upload>
import { getToken } from "@/api/qiniu"
data() {
  return {
    postData: { key: "", token: "" }
  }
},
methods:{
  beforeUpload(file) {
    getToken().then(response => {
      const token = response
      this.postData = {
        key: file.name,
        token: token
      }
    })
  }
}

qiniu.js

import request from "@/utils/request"

export function getToken() {
  return request({
    url: "/base/qtoken",
    method: "get"
  })
}

I would like to ask, isn"t before-upload executed before uploading? Why do I always visit https://up-z2.qiniup.com and then access the token interface every time I upload? if token doesn"t get it, it causes an error report

.

Uncaught (in promise) error


Uncaught (in promise) error

Mar.19,2022

clipboard.png

beforeUpload , Promise

 

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-1e47d7a-43923.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-1e47d7a-43923.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?