this.block.operation.push(...node)
}
+ registerOperationAt(node: OperationNode, index: number): void {
+ this.block.operation.splice(index, 0, node)
+ }
+
create<T extends TemplateChildNode>(
node: T,
index: number,
type IRProps,
type IRPropsDynamicAttribute,
type IRPropsStatic,
+ type OperationNode,
type VaporDirectiveNode,
} from '../ir'
import { EMPTY_EXPRESSION } from './utils'
-import { findProp } from '../utils'
+import { findDir, findProp } from '../utils'
export const isReservedProp: (key: string) => boolean = /*#__PURE__*/ makeMap(
// the leading comma is intentional so empty string "" is also included
}
context.dynamic.flags |= DynamicFlag.NON_TEMPLATE | DynamicFlag.INSERT
- context.registerOperation({
+ const op: OperationNode = {
type: IRNodeTypes.CREATE_COMPONENT_NODE,
id: context.reference(),
tag,
slots: [...context.slots],
once: context.inVOnce,
dynamic: dynamicComponent,
- })
+ }
+ const hasVShow = findDir(node, 'show')
+ if (hasVShow) {
+ const showOperationIndex = context.block.operation.findIndex(
+ op => op.type === IRNodeTypes.DIRECTIVE && op.name === 'show',
+ )
+ context.registerOperationAt(op, showOperationIndex)
+ } else {
+ context.registerOperation(op)
+ }
context.slots = []
}