From cbbc0e5efa7aa4d0a0d8e8ae5730262fa983dc4c Mon Sep 17 00:00:00 2001 From: Hossein Nedaee Date: Tue, 22 Oct 2019 23:04:17 +0330 Subject: [PATCH] Use returned value from toggle component on change event --- components/toggle.vue | 4 ++-- pages/index.vue | 2 +- pages/settings.vue | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/toggle.vue b/components/toggle.vue index a964a10ee..79bbef02a 100644 --- a/components/toggle.vue +++ b/components/toggle.vue @@ -92,8 +92,8 @@ methods: { toggle() { - this.$refs.toggle.classList.toggle("on"); - this.$emit('change', this.$refs.toggle.classList.contains("on")); + const containsOnClass = this.$refs.toggle.classList.toggle("on"); + this.$emit('change', containsOnClass); } } diff --git a/pages/index.vue b/pages/index.vue index 3286d7587..d8189a04e 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -100,7 +100,7 @@