1.0.12 • Published 3 years ago
xpf-img v1.0.12
xpf-img
A Vue.js project
Build Setup
# install package
npm i xpf-img --save
# install element-ui
npm i element-ui -S
# import package
import XpfImg from 'xpf-img'
# use it,you need to use choiceImg
<XpfImg @choiceImg="xxx"></XpfImg>
demo
<template>
<div id="app">
<XpfImg @choiceImg="uploadImg"></XpfImg>
</div>
</template>
<script>
import XpfImg from 'xpf-img'
import axios from 'axios'
export default {
components: {
XpfImg
},
methods: {
uploadImg (data) {
let formData = new FormData();
formData.append('files', data, "DX.jpg")
axios({
method: "post",
url: 'http://xxx/upload/remote',
data: formData,
headers: {
'Content-Type': 'multipart/form-data'
}
}).then((res) => {
console.log(res);
})
}
}
}
</script>