feat(ssr): support custom directive getSSRProps in optimized compilation
close #5304
This commit is contained in:
@@ -377,4 +377,20 @@ describe('ssr: components', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('custom directive', () => {
|
||||
test('basic', () => {
|
||||
expect(compile(`<foo v-xxx:x.y="z" />`).code).toMatchInlineSnapshot(`
|
||||
"const { resolveComponent: _resolveComponent, resolveDirective: _resolveDirective, mergeProps: _mergeProps } = require(\\"vue\\")
|
||||
const { ssrGetDirectiveProps: _ssrGetDirectiveProps, ssrRenderComponent: _ssrRenderComponent } = require(\\"vue/server-renderer\\")
|
||||
|
||||
return function ssrRender(_ctx, _push, _parent, _attrs) {
|
||||
const _component_foo = _resolveComponent(\\"foo\\")
|
||||
const _directive_xxx = _resolveDirective(\\"xxx\\")
|
||||
|
||||
_push(_ssrRenderComponent(_component_foo, _mergeProps(_attrs, _ssrGetDirectiveProps(_ctx, _directive_xxx, _ctx.z, \\"x\\", { y: true })), null, _parent))
|
||||
}"
|
||||
`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user