File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ import {
18
18
ComponentOptionsMixin ,
19
19
ComponentOptionsWithoutProps ,
20
20
ComputedOptions ,
21
- MethodOptions
21
+ MethodOptions ,
22
+ RenderFunction
22
23
} from './componentOptions'
23
24
import {
24
25
ComponentPropsOptions ,
@@ -311,6 +312,28 @@ type PropsWithDefaults<
311
312
: boolean
312
313
}
313
314
315
+ /**
316
+ * (**Experimental**) Vue `<script setup>` compiler macro for declaring
317
+ * the render function.
318
+ *
319
+ * The first argument can be a JSX element or a render function.
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * // JSX element
324
+ * defineRender(<div>hello</div>)
325
+ *
326
+ * // Render function
327
+ * defineRender(() => <div>hello</div>)
328
+ * defineRender(() => h('div', 'hello'))
329
+ * ```
330
+ */
331
+ export function defineRender ( renderFn : JSX . Element | RenderFunction ) : void {
332
+ if ( __DEV__ ) {
333
+ warnRuntimeUsage ( 'defineRender' )
334
+ }
335
+ }
336
+
314
337
/**
315
338
* Vue `<script setup>` compiler macro for providing props default values when
316
339
* using type-based `defineProps` declaration.
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ export {
72
72
defineOptions ,
73
73
defineSlots ,
74
74
defineModel ,
75
+ defineRender ,
75
76
withDefaults ,
76
77
useModel
77
78
} from './apiSetupHelpers'
You can’t perform that action at this time.
0 commit comments