From 01100c2849805600549beb09a2d4fd7ac309e0f8 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 27 Dec 2019 15:26:02 +0800 Subject: [PATCH] fix(h5): extract page's declarations #1157 --- packages/vue-cli-plugin-uni/packages/postcss/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/vue-cli-plugin-uni/packages/postcss/index.js b/packages/vue-cli-plugin-uni/packages/postcss/index.js index a5880f7cb..0b1300e03 100644 --- a/packages/vue-cli-plugin-uni/packages/postcss/index.js +++ b/packages/vue-cli-plugin-uni/packages/postcss/index.js @@ -171,22 +171,24 @@ if (process.env.UNI_USING_V3) { if (!isInsideKeyframes(rule)) { // rule.selectors == comma seperated selectors // a, b.c {} => ["a", "b.c"] - rule.selectors = rule.selectors.map(complexSelector => + rule.selectors = rule.selectors.map(complexSelector => { // complexSelector => simpleSelectors // "a.b#c" => ["a", ".b", "#c"] - transformSelector(complexSelector, simpleSelectors => + if (complexSelector === 'page') { + hasPage = true + } + return transformSelector(complexSelector, simpleSelectors => // only process type selector, leave alone class & id selectors simpleSelectors.walkTags(tag => { if (tag.value === 'page') { tag.value = 'uni-page-body' - hasPage = true } else if (~TAGS.indexOf(tag.value) && tag.value.substring( 0, 4) !== 'uni-') { tag.value = 'uni-' + tag.value } }) ) - ) + }) } // handle upx unit rule.walkDecls(decl => { -- GitLab