mirror of
https://github.com/bartvdbraak/SlayerWeightCalculator.git
synced 2025-04-27 17:41:22 +00:00
sync instead of emit for configdata
This commit is contained in:
parent
4c2e9183f0
commit
8a7e2a25b2
2 changed files with 14 additions and 12 deletions
|
@ -176,15 +176,11 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
beforeRouteLeave (to, from, next) {
|
||||
this.$emit('update',this.configData);
|
||||
next()
|
||||
},
|
||||
created() {
|
||||
this.setRemember()
|
||||
},
|
||||
watch: {
|
||||
configFile: function () {
|
||||
configFile() {
|
||||
if (window.File && window.FileReader && window.FileList && window.Blob) {
|
||||
this.readFile(this.configFile);
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<main role="main" class="col-md-10 ml-sm-auto col-lg-10 px-4">
|
||||
<router-view :configData="mainConfig" @update="updateConfig($event)"></router-view>
|
||||
<router-view :configData.sync="mainConfig"></router-view>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
|
@ -62,15 +62,21 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
updateConfig(eventData) {
|
||||
this.mainConfig = eventData;
|
||||
if (localStorage.getItem('remember') === 'true') {
|
||||
localStorage.setItem('configData', JSON.stringify(this.mainConfig));
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
mainConfig: {
|
||||
handler() {
|
||||
if (localStorage.getItem('remember') === 'true') {
|
||||
localStorage.setItem('configData', JSON.stringify(this.mainConfig));
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.mainConfig = JSON.parse(localStorage.getItem("configData"));
|
||||
if (localStorage.getItem("configData")) {
|
||||
this.mainConfig = JSON.parse(localStorage.getItem("configData"));
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue