Answer the question
In order to leave comments, you need to log in
How to show its preview when uploading a file, using vue.js as an example?
In data - I have downloadable files from <input type="file">
.
new Vue({
el: '#app',
data: function (){
return {
files: []
}
},
....................
<ul>
<li v-for="file in files">
<p>{{file.name}}</p>
</li>
</ul>`
Answer the question
In order to leave comments, you need to log in
Your input should have an @change function, for example, which you write to an array through e.target.files, new fileReader and readAsDataURL(), and in the loop already output img with src="data"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question