From 3c92244f5e369ca2f64e8fb796a6cc30300f7835 Mon Sep 17 00:00:00 2001 From: sheychen Date: Mon, 15 Apr 2019 13:13:20 +0200 Subject: [PATCH] Back to localStorage and update tricks --- main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 0bd7f60..607244c 100644 --- a/main.js +++ b/main.js @@ -10,11 +10,11 @@ var app = new Vue({ errors: [] }, mounted() { - if (sessionStorage.getItem(servicesStorage)) { + if (localStorage.getItem(servicesStorage)) { try { - this.services = JSON.parse(sessionStorage.getItem(servicesStorage)) + this.services = JSON.parse(localStorage.getItem(servicesStorage)) } catch (e) { - sessionStorage.removeItem(servicesStorage) + localStorage.removeItem(servicesStorage) } } }, @@ -40,18 +40,18 @@ var app = new Vue({ this.saveServices() }, setService(id, options) { - this.$set(this.services, id, { + this.services.push({ type: this.services[id].type, options: options }) - this.saveServices() + this.removeService(id) }, removeService(id) { this.services.splice(id, 1) this.saveServices() }, saveServices() { - sessionStorage.setItem(servicesStorage, JSON.stringify(this.services)) + localStorage.setItem(servicesStorage, JSON.stringify(this.services)) } } }) \ No newline at end of file