You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.1 KiB
Vue

<template>
<div id="upload">
<input v-on:change="fileChange($event)" type="file" multiple />
<p>selected {{fileCount}} files</p>
<ul>
<li v-bind:files="files" v-for="file in files">
{{ file.name }}
<ul>
<li>size: {{ file.size / 1000 }} kB </li>
<li>type: {{ file.type }} </li>
</ul>
</li>
</ul>
</div>
</template>
<script charset="utf-8">
import GetWorker from './workerInterface.js';
const w = GetWorker('main');
export default {
data(){
return {
fileCount: 0,
files: []
}
},
methods: {
fileChange(event) {
// reset
this.files = []
console.log("change")
this.fileCount = event.target.files.length
this.files = event.target.files
// Get sha256 of files
for (let file of this.files) {
w.post({
msg: 'file-sha256',
payload: file
})
}
}
}
}
</script>