跟随主后台优化
This commit is contained in:
23
src/composables/useThemeShell.ts
Normal file
23
src/composables/useThemeShell.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 页面壳主题组合式函数:返回 wd-config-provider 需要的 theme 值 + 进页时同步导航栏
|
||||
*
|
||||
* 用法(对齐 wot 官方深色方案):页面壳根节点用
|
||||
* <wd-config-provider :theme="wotTheme"> 包裹整页内容;
|
||||
* AppPageAtmosphere / AppPageForm 已内置,业务页无需关心
|
||||
*/
|
||||
import { computed } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
|
||||
import { useThemeStore } from '@/stores/theme'
|
||||
|
||||
export function useThemeShell() {
|
||||
const themeStore = useThemeStore()
|
||||
|
||||
/** 'light' | 'dark',跟随系统时已解析为具体值,首帧即正确 */
|
||||
const wotTheme = computed(() => themeStore.wotTheme)
|
||||
|
||||
// 每次进页补齐原生导航栏/窗口背景(强制模式下 theme.json 不会帮忙)
|
||||
onShow(() => themeStore.applyNavChrome())
|
||||
|
||||
return { themeStore, wotTheme }
|
||||
}
|
||||
Reference in New Issue
Block a user