Created
January 17, 2021 08:09
-
-
Save infantiablue/0c23af37db24766a3bad25476e1c569f to your computer and use it in GitHub Desktop.
Hnews Initializing Variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
created() { | |
if (!("topic" in localStorage)) localStorage.topic = "top"; | |
this.loadStories(localStorage.topic); | |
if (!("theme" in localStorage)) localStorage.theme = "dark"; | |
}, | |
mounted() { | |
this.toggleDarkMode(localStorage.theme); | |
this.$refs[`topic-${localStorage.topic}`].classList.add("text-green-500"); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment