vuetity
v-file-input
<v-file-input label="File input" @change="fileChange" v-model="file"></v-file-input>
<img :src="image" style="width:100%;height:200px;object-fit: cover;" />
js
fileChange () {
console.log('fileChange ')
console.log(this.file)
let reader = new FileReader()
let self = this
reader.readAsDataURL(this.file)
reader.onload = function (e) {
let dataBase64 = reader.result
console.log(dataBase64)
self.image = dataBase64
}
}
网友评论