blob: 6e7be2674dc49503bcdac2cc71db9311cc95b398 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* @flow */
import { makeMap } from 'shared/util'
// The "unitary tag" means that the tag node and its children
// must be sent to the native together.
const isUnitaryTag = makeMap('cell,header,cell-slot,recycle-list', true)
function preTransformNode (el: ASTElement, options: CompilerOptions) {
if (isUnitaryTag(el.tag) && !el.attrsList.some(item => item.name === 'append')) {
el.attrsMap.append = 'tree'
el.attrsList.push({ name: 'append', value: 'tree' })
}
if (el.attrsMap.append === 'tree') {
el.appendAsTree = true
}
}
function genData (el: ASTElement): string {
return el.appendAsTree ? `appendAsTree:true,` : ''
}
export default {
staticKeys: ['appendAsTree'],
preTransformNode,
genData
}
|