We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8cfc10a commit 7343f7cCopy full SHA for 7343f7c
1 file changed
packages/runtime-core/src/apiSetupHelpers.ts
@@ -382,17 +382,17 @@ export function withDefaults<
382
}
383
384
export function useSlots(): SetupContext['slots'] {
385
- return getContext().slots
+ return getContext('useSlots').slots
386
387
388
export function useAttrs(): SetupContext['attrs'] {
389
- return getContext().attrs
+ return getContext('useAttrs').attrs
390
391
392
-function getContext(): SetupContext {
+function getContext(calledFunctionName: string): SetupContext {
393
const i = getCurrentInstance()!
394
if (__DEV__ && !i) {
395
- warn(`useContext() called without active instance.`)
+ warn(`${calledFunctionName}() called without active instance.`)
396
397
return i.setupContext || (i.setupContext = createSetupContext(i))
398
0 commit comments