提交 7e0cd629 编写于 作者: fxy060608's avatar fxy060608

feat(cli): wraps text in a <text> tag (nvue)

上级 0e278acb
......@@ -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
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册