feat(compiler-dom/runtime-dom): stringify eligible static trees

This commit is contained in:
Evan You
2020-02-12 11:56:42 -05:00
parent e861c6da90
commit 27913e661a
13 changed files with 304 additions and 87 deletions

View File

@@ -39,6 +39,7 @@ export const Portal = (Symbol(__DEV__ ? 'Portal' : undefined) as any) as {
}
export const Text = Symbol(__DEV__ ? 'Text' : undefined)
export const Comment = Symbol(__DEV__ ? 'Comment' : undefined)
export const Static = Symbol(__DEV__ ? 'Static' : undefined)
export type VNodeTypes =
| string
@@ -46,6 +47,7 @@ export type VNodeTypes =
| typeof Fragment
| typeof Portal
| typeof Text
| typeof Static
| typeof Comment
| typeof SuspenseImpl
@@ -328,6 +330,10 @@ export function createTextVNode(text: string = ' ', flag: number = 0): VNode {
return createVNode(Text, null, text, flag)
}
export function createStaticVNode(content: string): VNode {
return createVNode(Static, null, content)
}
export function createCommentVNode(
text: string = '',
// when used as the v-else branch, the comment node must be created as a