提交 61549c56 编写于 作者: fxy060608's avatar fxy060608

fix(h5): darkmode

上级 3b9af626
......@@ -51,7 +51,6 @@ export function normalizeAppUniConfig(
manifestJson[
process.env.UNI_PLATFORM === 'app' ? 'app-plus' : process.env.UNI_PLATFORM
] || {}
const darkmode = platformConfig.darkmode || false
const config: AppUniConfig = {
pages: [],
......@@ -73,7 +72,7 @@ export function normalizeAppUniConfig(
networkTimeout: normalizeNetworkTimeout(manifestJson.networkTimeout),
tabBar: pagesJson.tabBar,
locales: initLocales(path.join(process.env.UNI_INPUT_DIR, 'locale')),
darkmode,
darkmode: platformConfig.darkmode || false,
themeConfig: normalizeThemeConfigOnce(platformConfig),
}
// TODO 待支持分包
......
......@@ -5,6 +5,7 @@ import {
normalizeNetworkTimeout,
parseJson,
initI18nOptions,
normalizeThemeConfigOnce,
} from '@dcloudio/uni-cli-shared'
const defaultRouter = {
......@@ -96,6 +97,13 @@ export function uniManifestJsonPlugin(): Plugin {
manifest['app'].nvue['flex-direction']) ||
'column'
const platformConfig =
manifest[
process.env.UNI_PLATFORM === 'app'
? 'app-plus'
: process.env.UNI_PLATFORM
] || {}
return {
code: `export const appId = ${JSON.stringify(manifest.appid || '')}
export const appName = ${JSON.stringify(manifest.name || '')}
......@@ -118,6 +126,10 @@ export function uniManifestJsonPlugin(): Plugin {
export const sdkConfigs = ${JSON.stringify(sdkConfigs)}
export const locale = '${locale}'
export const fallbackLocale = '${fallbackLocale}'
export const darkmode = ${platformConfig.darkmode || 'false'}
export const themeConfig = ${JSON.stringify(
normalizeThemeConfigOnce(platformConfig)
)}
`,
map: { mappings: '' },
}
......
......@@ -53,7 +53,7 @@ function generatePagesJsonCode(
return `
import { defineAsyncComponent, resolveComponent, createVNode, withCtx, openBlock, createBlock } from 'vue'
import { PageComponent, AsyncLoadingComponent, AsyncErrorComponent, useI18n, setupWindow, setupPage } from '@dcloudio/uni-h5'
import { appId, appName, appVersion, appVersionCode, debug, networkTimeout, router, async, sdkConfigs, qqMapKey, googleMapKey, aMapKey, aMapSecurityJsCode, aMapServiceHost, nvue, locale, fallbackLocale } from './${MANIFEST_JSON_JS}'
import { appId, appName, appVersion, appVersionCode, debug, networkTimeout, router, async, sdkConfigs, qqMapKey, googleMapKey, aMapKey, aMapSecurityJsCode, aMapServiceHost, nvue, locale, fallbackLocale, darkmode, themeConfig } from './${MANIFEST_JSON_JS}'
const locales = import.meta.globEager('./locale/*.json')
${importLayoutComponentsCode}
const extend = Object.assign
......@@ -270,6 +270,8 @@ function generateConfig(
fallbackLocale,
locales:Object.keys(locales).reduce((res,name)=>{const locale=name.replace(/\\.\\/locale\\/(uni-app.)?(.*).json/,'$2');extend(res[locale]||(res[locale]={}),locales[name].default);return res},{}),
router,
darkmode,
themeConfig,
})
`
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册