|
@@ -1,3 +1,10 @@
|
|
|
|
+<!--
|
|
|
|
+ * @Author: wjc
|
|
|
|
+ * @Date: 2024-07-10 10:35:44
|
|
|
|
+ * @LastEditors: wjc
|
|
|
|
+ * @LastEditTime: 2024-07-10 17:56:50
|
|
|
|
+ * @Description: 每个页面都会插入该组件,用于同步全局设置,比如主题
|
|
|
|
+-->
|
|
<template>
|
|
<template>
|
|
<page-meta>
|
|
<page-meta>
|
|
<navigation-bar v-bind="originNavBarStyle" />
|
|
<navigation-bar v-bind="originNavBarStyle" />
|
|
@@ -6,14 +13,16 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
+ import { onLaunch, onShow } from '@dcloudio/uni-app'
|
|
import { useAppStore } from '@/stores/modules/appStore'
|
|
import { useAppStore } from '@/stores/modules/appStore'
|
|
|
|
|
|
defineOptions({ name: 'Sys' })
|
|
defineOptions({ name: 'Sys' })
|
|
|
|
|
|
const appStore = useAppStore()
|
|
const appStore = useAppStore()
|
|
- const originNavBarStyle = computed(() => {
|
|
|
|
|
|
+
|
|
|
|
+ const setBarStyle = () => {
|
|
if (appStore.isDark) {
|
|
if (appStore.isDark) {
|
|
- return {
|
|
|
|
|
|
+ const styles: UniApp.SetNavigationbarColorOptions = {
|
|
frontColor: '#ffffff',
|
|
frontColor: '#ffffff',
|
|
backgroundColor: '#1a1a1a',
|
|
backgroundColor: '#1a1a1a',
|
|
animation: {
|
|
animation: {
|
|
@@ -21,8 +30,10 @@
|
|
timingFunc: 'easeIn',
|
|
timingFunc: 'easeIn',
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
+ uni.setNavigationBarColor(styles)
|
|
|
|
+ return styles
|
|
} else {
|
|
} else {
|
|
- return {
|
|
|
|
|
|
+ const styles: UniApp.SetNavigationbarColorOptions = {
|
|
frontColor: '#000000',
|
|
frontColor: '#000000',
|
|
backgroundColor: '#f8f8f8',
|
|
backgroundColor: '#f8f8f8',
|
|
animation: {
|
|
animation: {
|
|
@@ -30,6 +41,17 @@
|
|
timingFunc: 'easeIn',
|
|
timingFunc: 'easeIn',
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
+ uni.setNavigationBarColor(styles)
|
|
|
|
+ return styles
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const originNavBarStyle = computed(setBarStyle)
|
|
|
|
+
|
|
|
|
+ onLaunch(() => {
|
|
|
|
+ setBarStyle()
|
|
|
|
+ })
|
|
|
|
+ onShow(() => {
|
|
|
|
+ setBarStyle()
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|