xpf-img

1.0.12 • Public • Published

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>

Readme

Keywords

none

Package Sidebar

Install

npm i xpf-img

Weekly Downloads

1

Version

1.0.12

License

MIT

Unpacked Size

710 kB

Total Files

13

Last publish

Collaborators

  • otatoz