Skip to content

Instantly share code, notes, and snippets.

@PKTseng
Created August 11, 2020 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PKTseng/f0468b0b0b2c810fe71059e9511003d2 to your computer and use it in GitHub Desktop.
Save PKTseng/f0468b0b0b2c810fe71059e9511003d2 to your computer and use it in GitHub Desktop.
圖片上傳
<div id="app">
<input type="file" @change="selectFile">
</div>
new Vue({
el:"#app",
data:{
},
methods:{
selectFile(e){
const file = e.target.files.item(0);
console.log(file);
// const rander = new FileReader();
// rander.addEventListener('load', this.imageLoaded);.
// rander.readAsDataURL(file);
}
},
// inmageLoaded(e){
// this.image = e.target.restult;
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment