24 lines
834 B
TypeScript
24 lines
834 B
TypeScript
/**
|
|
* 页面壳主题组合式函数:返回 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 }
|
|
}
|