小说小程序前端代码仓库(小程序)
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.
 
 
 

18 lines
554 B

import { mapGetters, mapMutations } from 'vuex'
/**
* 主题模式混合器
* 提供了isDarkMode和currentTheme计算属性,以及toggleThemeMode和setThemeMode方法
* 使用方法:
* 1. 在组件中导入:import themeMixin from '@/mixins/themeMode.js'
* 2. 在组件中注册:mixins: [themeMixin]
* 3. 然后可以使用:this.isDarkMode 和 this.toggleThemeMode() 等
*/
export default {
computed: {
...mapGetters(['isDarkMode', 'currentTheme'])
},
methods: {
...mapMutations(['toggleThemeMode', 'setThemeMode'])
}
}