diff --git a/packages/runtime-vapor/src/component.ts b/packages/runtime-vapor/src/component.ts index cd920471b2c..027cbcff193 100644 --- a/packages/runtime-vapor/src/component.ts +++ b/packages/runtime-vapor/src/component.ts @@ -1027,14 +1027,25 @@ function handleSetupResult( devRender(instance) } } else { - // component has a render function but no setup function - // (typically components with only a template and no state) - if (setupResult === EMPTY_OBJ && component.render) { - instance.block = callWithErrorHandling( - component.render, - instance, - ErrorCodes.RENDER_FUNCTION, - ) + // component has a render function with either: + // - no setup function (components with only a template) + // - setup returning non-block state for use in render + // support setup fn and render fn co-usage for expose + if (!isBlock(setupResult) && component.render) { + instance.setupState = proxyRefs(setupResult) + instance.block = + callWithErrorHandling( + component.render, + instance, + ErrorCodes.RENDER_FUNCTION, + [ + instance.setupState, + instance.props, + instance.emit, + instance.attrs, + instance.slots, + ], + ) || [] } else { // in prod result can only be block instance.block = setupResult as Block