Skip to content

Commit

Permalink
fix(DarkToggle): 监听页面主题变动
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhankui committed Feb 11, 2023
1 parent 8abc41f commit ca9ca1c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/components/Uno/DarkToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ if (process.client) {
else
setLight()
})
window.addEventListener('storage', (e) => {
if (e.newValue === 'light')
setLight()
else
setDark()
})
}
</script>

Expand Down

0 comments on commit ca9ca1c

Please sign in to comment.