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

fix(h5): darkmode

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