From 58b5a5772115cd423b63a6afbcc8b813b5a4911f Mon Sep 17 00:00:00 2001 From: Vick Scarlet Date: Thu, 19 Aug 2021 09:21:28 +0800 Subject: [PATCH] bug fix --- src/app.js | 4 ++-- src/life.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app.js b/src/app.js index dd1a28c..3594431 100644 --- a/src/app.js +++ b/src/app.js @@ -445,8 +445,8 @@ class App{ }); } - get times() {return localStorage.times || 0;} - set times(v) {localStorage.times = parseInt(v) || 0}; + get times() {return JSON.parse(localStorage.times||'') || 0;} + set times(v) {localStorage.times = JSON.stringify(parseInt(v) || 0)}; } diff --git a/src/life.js b/src/life.js index 6420d08..85b0234 100644 --- a/src/life.js +++ b/src/life.js @@ -99,11 +99,11 @@ class Life { } talentRandom() { - return this.#talent.talentRandom(localStorage.extendTalent); + return this.#talent.talentRandom(JSON.parse(localStorage.extendTalent||'')); } talentExtend(talentId) { - localStorage.extendTalent = talentId; + localStorage.extendTalent = JSON.stringify(talentId); } getRecord() {