diff --git a/packages/vue-cli-plugin-hbuilderx/build/vue-loader.conf.js b/packages/vue-cli-plugin-hbuilderx/build/vue-loader.conf.js index 8f623da8ae534532518e9f578e0aae53139a30ab..0d77cadc406aca9a70162d6fe51896dfa20127ba 100644 --- a/packages/vue-cli-plugin-hbuilderx/build/vue-loader.conf.js +++ b/packages/vue-cli-plugin-hbuilderx/build/vue-loader.conf.js @@ -17,9 +17,33 @@ const deprecated = { } } -if (process.env.UNI_USING_NVUE_COMPILER) { +if (process.env.UNI_USING_NVUE_COMPILER) { + const wrapperTextTag = function (el, options) { + const tag = el.tag + if (tag === 'text' || tag === 'button') { + return + } + const children = el.children + children.forEach((child, index) => { + if (child.text) { + children.splice(index, 1, { + type: 1, + tag: 'u-text', + attrsList: [], + attrsMap: {}, + rawAttrsMap: {}, + parent: el, + children: [child], + plain: true + }) + } + }) + } + modules.push({ - postTransformNode (el) { + postTransformNode (el, options) { + wrapperTextTag(el, options) + if (TAGS.includes(el.tag)) { el.tag = 'u-' + el.tag }