提交 02752ddb 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(h5): 修复page选择器媒体查询无效问题

上级 e0797029
......@@ -170,8 +170,6 @@ if (process.env.UNI_USING_V3) {
if (process.env.UNI_PLATFORM === 'h5') {
// Transform CSS AST here
const bgDecls = []
root.walkRules(rule => {
let hasPage = false
// Transform each rule here
......@@ -197,6 +195,7 @@ if (process.env.UNI_USING_V3) {
)
})
}
const bgDecls = []
// handle upx unit
rule.walkDecls(decl => {
if (hasPage) {
......@@ -207,6 +206,15 @@ if (process.env.UNI_USING_V3) {
// Transform each property declaration here
decl.value = tranformValue(decl.value, opts)
})
// handle body background rule
if (bgDecls.length) {
const bodyRule = postcss.rule({
selector: 'body.?%PAGE?%'
})
bgDecls.forEach(decl => bodyRule.append(decl))
rule.after(bodyRule)
}
})
root.walkAtRules(rule => {
......@@ -214,14 +222,6 @@ if (process.env.UNI_USING_V3) {
rule.params = tranformValue(rule.params, opts)
}
})
if (bgDecls.length) {
const rule = postcss.rule({
selector: 'body.?%PAGE?%'
})
bgDecls.forEach(decl => rule.append(decl))
root.append(rule)
}
} else {
root.walkRules(rule => {
const selectors = transformSelector(rule.selectors.join(','), function (selectors) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册