uploadTitleImg() {
let data = new FormData();
let dom = document.getElementsByName('blobup_file')[0]
let file = dom.files[0]
dom.setAttribute('type', 'text')
setTimeout(() => {
dom.setAttribute('type', 'file')
}, 500)
let path = new Date().getTime().toString()
var files = new File([file], path + '.jpg', { type: 'image/jpeg' })
debugger
data.append("myfile",files);
request({
url: '',
method: 'post',
data: data,
}).then((res) => {
this.obj.goodsImg = imgurl + res.imgurl
}).catch((res) => {
tool.message(res.message, 'error')
})
},
修改照片名字
var files = new File([file], path + '.jpg', { type: 'image/jpeg' })