Skip to content

Commit

Permalink
hotfix: save process
Browse files Browse the repository at this point in the history
  • Loading branch information
LordFitoi committed Apr 4, 2024
1 parent 0eb5001 commit 1c395b0
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/components/BatteryBalanceApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,28 +122,21 @@ export default {
mounted() {
this.load();
},
watch: {
cells: {
handler() {
this.save();
},
deep: true
}
},
methods: {
save() {
localStorage.setItem('cells', JSON.stringify(this.cells));
},
load() {
this.cells = JSON.parse(localStorage.getItem('cells'));
},
addCell() {
this.cells.push(Number(this.cellInput));
this.cellInput = null;
this.save();
},
removeCell(i) {
this.cells.splice(i, 1);
this.save();
},
buildPack() {
if (this.cells.length < 1) {
Expand Down

0 comments on commit 1c395b0

Please sign in to comment.