You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
450 B
19 lines
450 B
const {
|
|
ID
|
|
} = require('../util')
|
|
|
|
const {
|
|
isComponent
|
|
} = require('../../util')
|
|
|
|
// 仅限 view 层
|
|
module.exports = function parseComponent (el) {
|
|
// 需要把自定义组件的 attrs, props 全干掉
|
|
if (el.tag && isComponent(el.tag)) {
|
|
// 仅保留 id、ID、data
|
|
el.attrs && (el.attrs = el.attrs.filter(attr => {
|
|
const name = attr.name
|
|
return name === 'id' || name === ID || name.indexOf('data-') === 0
|
|
}))
|
|
}
|
|
}
|
|
|