js 将文本以文件的形式上传到服务器
let file;
const properties = {type: 'text/plain'}, data = this.code;
try {
file = new File([data], "file.txt", properties);
} catch (e) {
file = new Blob(data, properties);
}
const formData = new FormData()
formData.append('file', file, key)
postAction(this.url.uploadUrl, formData).then(res => {
if (res.success) {
}
});