X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fcomponents%2FSettingToggle.vue;h=efa7caa89e06142f8ebe8ce13422221fcd48ce54;hb=49c2023b8e7eea6b28113b43beca29ee865faebc;hp=94655bcab19aa06eb33dc54e93b4456e2720b26b;hpb=b9c5fcf085bed9c6100283133531b36bfbb06cf0;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/src/components/SettingToggle.vue b/src/components/SettingToggle.vue index 94655bc..efa7caa 100644 --- a/src/components/SettingToggle.vue +++ b/src/components/SettingToggle.vue @@ -1,7 +1,9 @@ @@ -13,19 +15,21 @@ export default { name: String, icon: String, iconAlt: String, + defaultValue: Boolean, }, data: function () { return { + secondaryIcon: null, value: true, }; }, created: function () { - if (!this.iconAlt) { - this.iconAlt = this.icon; - } + this.secondaryIcon = this.iconAlt || this.icon; if (this.name in localStorage) { this.value = JSON.parse(localStorage[this.name]); + } else { + this.value = this.defaultValue; } this.$emit("updated", this.value);