<div class="upload">
//
<div class="show" v-bind:class="{showpic: is_show_pic}">
// src vue data
<img style="text-align:center" :src="src" width="100px">
<span class="delete-pic" @click="delete_pic">x</span>
</div>
// inputlabel
<input @change="show_pic" type="file" id="file" class="inputfile" accept="image/png, image/jpeg, image/jpg" />
// label
<label :class="{hide: isHide}" for="file" class="file-label"></label>
</div>
show_pic(e) {
f = e.target.files[0]
var reads= new FileReader();
reads.readAsDataURL(f);
let that = this
reads.onload=function (e) {
// vue data src
that.src=this.result;
};
this.is_show_pic = true
this.isHide = true
},
//
delete_pic() {
// vue data
// show_pic
// inputfile
//
//
this.src = ""
},