feat(ssr): support custom directive getSSRProps in optimized compilation
close #5304
This commit is contained in:
@@ -5,7 +5,8 @@ import {
|
||||
ErrorCodes,
|
||||
BindingTypes,
|
||||
NodeTransform,
|
||||
transformExpression
|
||||
transformExpression,
|
||||
baseCompile
|
||||
} from '../../src'
|
||||
import {
|
||||
RESOLVE_COMPONENT,
|
||||
@@ -66,6 +67,7 @@ function parseWithBind(template: string, options?: CompilerOptions) {
|
||||
return parseWithElementTransform(template, {
|
||||
...options,
|
||||
directiveTransforms: {
|
||||
...options?.directiveTransforms,
|
||||
bind: transformBind
|
||||
}
|
||||
})
|
||||
@@ -932,7 +934,11 @@ describe('compiler: element transform', () => {
|
||||
})
|
||||
|
||||
test('NEED_PATCH (vnode hooks)', () => {
|
||||
const { node } = parseWithBind(`<div @vnodeUpdated="foo" />`)
|
||||
const root = baseCompile(`<div @vnodeUpdated="foo" />`, {
|
||||
prefixIdentifiers: true,
|
||||
cacheHandlers: true
|
||||
}).ast
|
||||
const node = (root as any).children[0].codegenNode
|
||||
expect(node.patchFlag).toBe(genFlagText(PatchFlags.NEED_PATCH))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user