Add an explicit load button to deck JSON upload

This commit is contained in:
Adam Goldsmith 2019-01-09 20:39:25 -05:00
parent f310782fc3
commit b726813587

View File

@ -22,8 +22,9 @@
<div> <div>
<label> Upload JSON: WARNING: WILL CLEAR DECK <label> Upload JSON: WARNING: WILL CLEAR DECK
<input @change="jsonUpload" type="file"> <input ref="jsonUpload" type="file">
</label> </label>
<button type="button" @click="jsonUpload"> Load </button>
</div> </div>
<div> <div>
@ -96,7 +97,7 @@
methods: { methods: {
// deck JSON uploader // deck JSON uploader
jsonUpload(event) { jsonUpload(event) {
let files = event.target.files; let files = this.$refs.jsonUpload.files;
let reader = new FileReader(); let reader = new FileReader();
reader.onload = e => this.deckInfo = yaml.safeLoad(e.target.result); reader.onload = e => this.deckInfo = yaml.safeLoad(e.target.result);
reader.readAsText(files[0]); reader.readAsText(files[0]);