import store from '@/store' export default { data() { return { pattern: '', fontMain: '', bgMain: '' } }, onShow() { this.themeInit() }, onReady() { this.themeInit() }, methods: { themeInit() { this.pattern = store.getters.pattern this.setNavbar(this.pattern) this.setTabbar(this.pattern) this.fontMain = this.pattern == 'dark' ? '#FFFFFF' : '#000000' this.bgMain = this.pattern == 'dark' ? '#102030' : '#F6F6F6' }, setNavbar(item) { if (item == 'dark') { uni.setNavigationBarColor({ frontColor: "#ffffff", backgroundColor: "#102030" }) } else { uni.setNavigationBarColor({ frontColor: "white", backgroundColor: "rgb(9 56 106)" }) } }, setTabbar(item) { if (item == 'dark') { uni.setTabBarStyle({ color: '#a2a6a5', selectedColor: '#1881d2', backgroundColor: '#16263e', borderStyle: 'black' }) } else { uni.setTabBarStyle({ color: '#999999', selectedColor: '#292C35', backgroundColor: '#ffffff', borderStyle: 'white' }) } }, } }