提交 840b92c8 编写于 作者: Q qiang

fix(H5): easycom components name

上级 aaf5a355
const { const {
ID ID,
elements
} = require('../util') } = require('../util')
const { const {
...@@ -9,7 +10,7 @@ const { ...@@ -9,7 +10,7 @@ const {
// 仅限 view 层 // 仅限 view 层
module.exports = function parseComponent (el) { module.exports = function parseComponent (el) {
// 需要把自定义组件的 attrs, props 全干掉 // 需要把自定义组件的 attrs, props 全干掉
if (el.tag && isComponent(el.tag)) { if (el.tag && !elements.includes(el.tag) && isComponent(el.tag)) {
// 仅保留 id、ID、data // 仅保留 id、ID、data
el.attrs && (el.attrs = el.attrs.filter(attr => { el.attrs && (el.attrs = el.attrs.filter(attr => {
const name = attr.name const name = attr.name
......
const { const {
hasOwn hasOwn,
elements
} = require('../util') } = require('../util')
const tags = require('@dcloudio/uni-cli-shared/lib/tags') const tags = require('@dcloudio/uni-cli-shared/lib/tags')
// web components
const elements = ['uni-view']
// 仅限 view 层 // 仅限 view 层
module.exports = function parseTag (el) { module.exports = function parseTag (el) {
const tag = el.tag const tag = el.tag
......
...@@ -20,6 +20,9 @@ const V_FOR = 'f' ...@@ -20,6 +20,9 @@ const V_FOR = 'f'
const V_IF = 'i' const V_IF = 'i'
const V_ELSE_IF = 'e' const V_ELSE_IF = 'e'
// web components
const elements = ['uni-view']
function isVar (str) { function isVar (str) {
if (!str) { if (!str) {
return false return false
...@@ -273,6 +276,7 @@ module.exports = { ...@@ -273,6 +276,7 @@ module.exports = {
GET_DATA, GET_DATA,
SET_MP_CLASS, SET_MP_CLASS,
GET_CHANGE_DATA, GET_CHANGE_DATA,
elements,
isVar, isVar,
hasOwn, hasOwn,
addAttr, addAttr,
...@@ -288,4 +292,4 @@ module.exports = { ...@@ -288,4 +292,4 @@ module.exports = {
getBindingAttr, getBindingAttr,
getAndRemoveAttr, getAndRemoveAttr,
traverseNode traverseNode
} }
...@@ -210,7 +210,7 @@ function isComponent (tagName) { ...@@ -210,7 +210,7 @@ function isComponent (tagName) {
return false return false
} }
} }
return !hasOwn(tags, getTagName(tagName.replace(/^(v-)?uni-/, ''))) return !hasOwn(tags, getTagName(tagName.replace(/^v-uni-/, '')))
} }
function makeMap (str, expectsLowerCase) { function makeMap (str, expectsLowerCase) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册