vue图片上传demo
1.vue页面 引用 import VueImgInputer from 'vue-img-inputer' 组件 展示如下 <div class="prove-list-right"> <div class="prove-right-img" @change="showimgUrl"> <VueImgInputer id="imgjust1" v-model="imgUrl" theme="light" :imgSrc="默认的图" :nhe="false" noMask> </VueImgInputer> </div> </div> 2.js写法 export default { name: 'setting', data: () => ({ imgSrc: '默认图片的地址 不支持相对路径', imgUrl: '' }), mounted () { }, methods: { // 图片上传后返回地址 showimgUrl () { let formData = new FormData() formData.append('file', this.imgUrl) formData.append('token', this.$store.state.token.token) this.postForm(api.BaseUrl + api.modifyAvatar,