<input id="uploadFile" accept="image/*"type="file" @change="changeFile" />
async function changeFile(e) {
// FormData私有类对象,访问不到,可以通过get判断值是否传进去
// console.log(param.get('smfile'))
// let res = await smmsApi.upload(param)
let file = e.target.files[0]
let param = new FormData()
param.append('smfile', file)
const accessKey = 'xxxxxx'
const option = {
mode: 'cors',
method: 'post',
headers: {
Authorization: accessKey
},
body: param
}
const res = await fetch('https://sm.ms/api/v2/upload', option)
console.log('🚀 ~ changeFile ~ res:', await res.json())
}