diff --git a/packages/uni-template-compiler/lib/app/parser/tag-parser.js b/packages/uni-template-compiler/lib/app/parser/tag-parser.js index 0ac94d9801c952ca4f4a67ecfaf2992ed62fd217..70e7d0dc0b4249c023802950ceb63ca0673d7c12 100644 --- a/packages/uni-template-compiler/lib/app/parser/tag-parser.js +++ b/packages/uni-template-compiler/lib/app/parser/tag-parser.js @@ -4,8 +4,17 @@ const { const tags = require('@dcloudio/uni-cli-shared/lib/tags') +// web components +const elements = ['uni-view'] + // 仅限 view 层 module.exports = function parseTag (el) { + const tag = el.tag + const element = elements.find(element => tag === element || 'uni-' + tag === element) + if (element) { + el.tag = element + return + } if (el.tag.indexOf('v-uni-') !== 0 && hasOwn(tags, el.tag)) { el.tag = 'v-uni-' + el.tag } diff --git a/packages/uni-template-compiler/lib/util.js b/packages/uni-template-compiler/lib/util.js index fa0ef6afaf359ce1641751695de3bfcc6000d762..5e68bb7dc448d310a7861de4cece433f8d41069c 100644 --- a/packages/uni-template-compiler/lib/util.js +++ b/packages/uni-template-compiler/lib/util.js @@ -210,7 +210,7 @@ function isComponent (tagName) { return false } } - return !hasOwn(tags, getTagName(tagName.replace('v-uni-', ''))) + return !hasOwn(tags, getTagName(tagName.replace(/^(v-)?uni-/, ''))) } function makeMap (str, expectsLowerCase) {