mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
upload image fix
This commit is contained in:
parent
0abb90cb4f
commit
779760b281
@ -131,7 +131,7 @@ export default {
|
|||||||
data.append('file', pasteFile)
|
data.append('file', pasteFile)
|
||||||
|
|
||||||
fileApi.fileUpload(data).then(res => {
|
fileApi.fileUpload(data).then(res => {
|
||||||
this.uploaded(res.data)
|
this.uploaded(res)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err.message)
|
console.log(err.message)
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container class="top">
|
<el-container class="top">
|
||||||
<!-- 图片上传 -->
|
<!-- 图片上传 -->
|
||||||
<el-upload class="header__item" action="https://imgkr.com/api/files/upload" :headers="{'Content-Type': 'multipart/form-data'}"
|
<el-upload class="header__item" action="https://imgkr.com/api/files/upload"
|
||||||
|
:headers="{'Content-Type': 'multipart/form-data'}"
|
||||||
:show-file-list="false" :multiple="true" accept=".jpg,.jpeg,.png,.gif" name="file"
|
:show-file-list="false" :multiple="true" accept=".jpg,.jpeg,.png,.gif" name="file"
|
||||||
:before-upload="beforeUpload" :on-success="uploaded">
|
:before-upload="beforeUpload" :on-success="uploaded">
|
||||||
<el-tooltip effect="dark" content="上传图片" placement="bottom-start">
|
<el-tooltip effect="dark" content="上传图片" placement="bottom-start">
|
||||||
@ -69,6 +70,7 @@ import {
|
|||||||
setFontSize,
|
setFontSize,
|
||||||
isImageIllegal
|
isImageIllegal
|
||||||
} from '../../scripts/util'
|
} from '../../scripts/util'
|
||||||
|
import fileApi from '../../api/file';
|
||||||
import {
|
import {
|
||||||
solveWeChatImage,
|
solveWeChatImage,
|
||||||
solveHtml
|
solveHtml
|
||||||
@ -165,7 +167,15 @@ export default {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
let fd = new FormData();
|
||||||
|
|
||||||
|
fd.append('file', file);
|
||||||
|
fileApi.fileUpload(fd).then(res => {
|
||||||
|
this.uploaded(res)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.message)
|
||||||
|
})
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
// 复制到微信公众号
|
// 复制到微信公众号
|
||||||
copy() {
|
copy() {
|
||||||
|
Loading…
Reference in New Issue
Block a user