You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
628 B

<template>
<v-btn
icon
fab
@click="isDark=!isDark"
>
<v-icon v-if="isDark">
mdi-moon-waxing-crescent
</v-icon>
<v-icon v-else>
mdi-white-balance-sunny
</v-icon>
</v-btn>
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
data() {
return {
isDark: false
}
},
watch: {
isDark() {
this.$vuetify.theme.dark = this.isDark
localStorage.setItem('dark', JSON.stringify(this.isDark))
}
},
created() {
const dark = localStorage.getItem('dark')
this.isDark = dark ? JSON.parse(dark) : false
}
})
</script>