feat(ssr): support custom directive getSSRProps in optimized compilation
close #5304
This commit is contained in:
26
packages/server-renderer/src/helpers/ssrGetDirectiveProps.ts
Normal file
26
packages/server-renderer/src/helpers/ssrGetDirectiveProps.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { ComponentPublicInstance, Directive } from '@vue/runtime-core'
|
||||
|
||||
export function ssrGetDirectiveProps(
|
||||
instance: ComponentPublicInstance,
|
||||
dir: Directive,
|
||||
value?: any,
|
||||
arg?: string,
|
||||
modifiers: Record<string, boolean> = {}
|
||||
): Record<string, any> {
|
||||
if (typeof dir !== 'function' && dir.getSSRProps) {
|
||||
return (
|
||||
dir.getSSRProps(
|
||||
{
|
||||
dir,
|
||||
instance,
|
||||
value,
|
||||
oldValue: undefined,
|
||||
arg,
|
||||
modifiers
|
||||
},
|
||||
null as any
|
||||
) || {}
|
||||
)
|
||||
}
|
||||
return {}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ export {
|
||||
export { ssrInterpolate } from './helpers/ssrInterpolate'
|
||||
export { ssrRenderList } from './helpers/ssrRenderList'
|
||||
export { ssrRenderSuspense } from './helpers/ssrRenderSuspense'
|
||||
export { ssrGetDirectiveProps } from './helpers/ssrGetDirectiveProps'
|
||||
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared'
|
||||
|
||||
// v-model helpers
|
||||
|
||||
Reference in New Issue
Block a user