提交 8175045b 编写于 作者: D DCloud_LXH

fix: darkmode easycom question/156809

上级 3dec14ed
import { extend } from '@vue/shared'
import { initRecursiveMerge } from './merge'
import { initDefaultManifestJson } from './defaultManifestJson'
import { initAppStatusbar } from './statusbar'
......@@ -22,7 +23,8 @@ export function normalizeAppManifestJson(
initDefaultManifestJson(),
userManifestJson
)
pagesJson = initTheme(manifestJson, pagesJson)
const { pages, globalStyle, tabBar } = initTheme(manifestJson, pagesJson)
extend(pagesJson, { pages, globalStyle, tabBar })
initAppStatusbar(manifestJson, pagesJson)
initArguments(manifestJson, pagesJson)
initPlus(manifestJson, pagesJson)
......
......@@ -182,7 +182,8 @@ function parsePagesJson(
appJson.themeLocation = 'theme.json'
} else {
const manifestJson = parseManifestJsonOnce(process.env.UNI_INPUT_DIR)
appJson = initTheme(manifestJson, appJson)
const { pages, window, tabBar } = initTheme(manifestJson, appJson)
extend(appJson, { pages, window, tabBar })
pageJsons = initTheme(manifestJson, pageJsons)
}
return {
......
......@@ -12,7 +12,7 @@ import { parseJson } from './json'
import { isVueSfcFile } from '../vue/utils'
import { parseVueRequest } from '../vite'
import { EXTNAME_VUE_RE, TEXT_STYLE } from '../constants'
import { initTheme } from './theme'
import { initTheme, normalizeThemeConfigOnce } from './theme'
import { getPlatformManifestJsonOnce } from './manifest'
const pagesCacheSet: Set<string> = new Set()
......@@ -133,7 +133,11 @@ export function normalizePagesJson(
const manifestJsonPlatform = getPlatformManifestJsonOnce()
if (!manifestJsonPlatform.darkmode) {
pagesJson = initTheme(manifestJsonPlatform, pagesJson)
const { pages, globalStyle, tabBar } = initTheme(
manifestJsonPlatform,
pagesJson
)
extend(pagesJson, { pages, globalStyle, tabBar })
}
return pagesJson
......@@ -444,8 +448,8 @@ function normalizeTabBar(
const SCHEME_RE = /^([a-z-]+:)?\/\//i
const DATA_RE = /^data:.*,.*/
function normalizeFilepath(filepath: string) {
const manifestJsonPlatform = getPlatformManifestJsonOnce()
if (manifestJsonPlatform.darkmode && filepath.startsWith('@')) return filepath
const themeConfig = normalizeThemeConfigOnce()['light'] || {}
if (themeConfig[filepath.replace('@', '')]) return filepath
if (
!(SCHEME_RE.test(filepath) || DATA_RE.test(filepath)) &&
filepath.indexOf('/') !== 0
......
......@@ -17,7 +17,7 @@ export function normalizeTitleColor(titleColor: string) {
export function normalizeStyles<T extends Object>(
pageStyle: T,
themeConfig: UniApp.ThemeJson,
themeConfig: UniApp.ThemeJson = {},
mode: UniApp.ThemeMode = 'light'
) {
const modeStyle = themeConfig[mode]
......@@ -42,7 +42,7 @@ export function normalizeStyles<T extends Object>(
)
} else if (isString(styleItem) && styleItem.startsWith('@')) {
const _key = styleItem.replace('@', '')
let _styleItem = modeStyle[_key]
let _styleItem = modeStyle[_key] || styleItem
switch (key) {
case 'titleColor':
_styleItem = normalizeTitleColor(_styleItem)
......
......@@ -5224,7 +5224,7 @@ packages:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
/graceful-fs/4.2.9:
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/}
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/, tarball: https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz}
dev: true
/has-flag/3.0.0:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册