智能照明系统APP-本地串口
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.
LightingSystemApp-serial/.svn/pristine/06/06afde62482d4275ccbfe8c6af2...

61 lines
1.7 KiB

3 years ago
/* @flow */
import { preTransformRecycleList } from './recycle-list'
import { postTransformComponent } from './component'
import { postTransformComponentRoot } from './component-root'
import { postTransformText } from './text'
import { preTransformVBind } from './v-bind'
import { preTransformVIf } from './v-if'
import { preTransformVFor } from './v-for'
import { postTransformVOn } from './v-on'
import { preTransformVOnce } from './v-once'
let currentRecycleList = null
function shouldCompile (el: ASTElement, options: WeexCompilerOptions) {
return options.recyclable ||
(currentRecycleList && el !== currentRecycleList)
}
function preTransformNode (el: ASTElement, options: WeexCompilerOptions) {
if (el.tag === 'recycle-list') {
preTransformRecycleList(el, options)
currentRecycleList = el
}
if (shouldCompile(el, options)) {
preTransformVBind(el)
preTransformVIf(el, options) // also v-else-if and v-else
preTransformVFor(el, options)
preTransformVOnce(el)
}
}
function transformNode (el: ASTElement, options: WeexCompilerOptions) {
if (shouldCompile(el, options)) {
// do nothing yet
}
}
function postTransformNode (el: ASTElement, options: WeexCompilerOptions) {
if (shouldCompile(el, options)) {
// mark child component in parent template
postTransformComponent(el, options)
// mark root in child component template
postTransformComponentRoot(el)
// <text>: transform children text into value attr
if (el.tag === 'text') {
postTransformText(el)
}
postTransformVOn(el)
}
if (el === currentRecycleList) {
currentRecycleList = null
}
}
export default {
preTransformNode,
transformNode,
postTransformNode
}