提交 8fb8d9a0 编写于 作者: D DCloud_LXH

fix(h5): darkmode

上级 4aafbc39
...@@ -3,7 +3,7 @@ const mediaQuerys = [] ...@@ -3,7 +3,7 @@ const mediaQuerys = []
module.exports = { module.exports = {
splitMediaPlugin: function (root, result) { splitMediaPlugin: function (root, result) {
root.walkAtRules(rule => { root.walkAtRules(rule => {
if (rule.params === '(perfers-color-scheme:dark)') { if (rule.params.indexOf('prefers-color-scheme') !== -1) {
root.removeChild(rule) root.removeChild(rule)
mediaQuerys.push(rule) mediaQuerys.push(rule)
......
...@@ -60,10 +60,7 @@ module.exports = { ...@@ -60,10 +60,7 @@ module.exports = {
if (platformOptions.darkmode === true && darkPath) { if (platformOptions.darkmode === true && darkPath) {
copyOptions.push({ copyOptions.push({
from: require.resolve('@dcloudio/uni-h5/dist/index.dark.css'), from: require.resolve('@dcloudio/uni-h5/dist/index.dark.css'),
to: getIndexCssPath(vueOptions.assetsDir, platformOptions.template, 'VUE_APP_INDEX_DARK_CSS_HASH'), to: getIndexCssPath(vueOptions.assetsDir, platformOptions.template, 'VUE_APP_INDEX_DARK_CSS_HASH')
transform: (content) => {
}
}) })
} }
......
...@@ -35,7 +35,7 @@ process.env.UNI_APP_NAME = manifestJsonObj.name || '' ...@@ -35,7 +35,7 @@ process.env.UNI_APP_NAME = manifestJsonObj.name || ''
process.env.UNI_PLATFORM = process.env.UNI_PLATFORM || 'h5' process.env.UNI_PLATFORM = process.env.UNI_PLATFORM || 'h5'
process.env.UNI_APP_VERSION_NAME = manifestJsonObj.versionName process.env.UNI_APP_VERSION_NAME = manifestJsonObj.versionName
process.env.UNI_APP_VERSION_CODE = manifestJsonObj.versionCode process.env.UNI_APP_VERSION_CODE = manifestJsonObj.versionCode
process.env.VUE_APP_DARK_MODE = (manifestJsonObj[process.env.UNI_PLATFORM] || {}).darkmode process.env.VUE_APP_DARK_MODE = (manifestJsonObj[process.env.UNI_PLATFORM] || {}).darkmode || false
// 小程序 vue3 标记 // 小程序 vue3 标记
if (process.env.UNI_PLATFORM.indexOf('mp-') === 0) { if (process.env.UNI_PLATFORM.indexOf('mp-') === 0) {
...@@ -274,7 +274,6 @@ if (process.env.UNI_PLATFORM === 'h5') { ...@@ -274,7 +274,6 @@ if (process.env.UNI_PLATFORM === 'h5') {
process.env.VUE_APP_INDEX_DARK_CSS_HASH = loaderUtils.getHashDigest(indexDarkCssBuffer, 'md5', 'hex', 8) process.env.VUE_APP_INDEX_DARK_CSS_HASH = loaderUtils.getHashDigest(indexDarkCssBuffer, 'md5', 'hex', 8)
} catch (error) { } catch (error) {
process.env.VUE_APP_INDEX_DARK_CSS_HASH = '' process.env.VUE_APP_INDEX_DARK_CSS_HASH = ''
process.env.VUE_APP_DARK_MODE = false
} }
} }
......
...@@ -127,7 +127,11 @@ module.exports = function (content, map) { ...@@ -127,7 +127,11 @@ module.exports = function (content, map) {
if (process.env.UNI_PLATFORM === 'h5') { if (process.env.UNI_PLATFORM === 'h5') {
return this.callback( return this.callback(
null, null,
require('./platforms/h5')(originalPagesJson, manifestJson, this), require('./platforms/h5')(
process.env.VUE_APP_DARK_MODE === 'true' ? originalPagesJson : pagesJson,
manifestJson,
this
),
map map
) )
} }
......
...@@ -257,14 +257,9 @@ export default { ...@@ -257,14 +257,9 @@ export default {
titleNView titleNView
} = normalizeNavigationBar.call(this) } = normalizeNavigationBar.call(this)
if (__uniConfig.darkmode) {
}
return { return {
navigationBar, navigationBar,
refreshOptions: getRefreshOptions.call(this, titleNView), refreshOptions: getRefreshOptions.call(this, titleNView)
darkmodeStyle: {}
} }
}, },
created () { created () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册