fix(runtime-core): add useAttrs and useSlots export (#4053)

This commit is contained in:
wonderl17 2021-07-02 19:51:09 +08:00 committed by GitHub
parent 2788154f77
commit 735ada1507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -58,7 +58,9 @@ export {
withAsyncContext, withAsyncContext,
// deprecated // deprecated
defineEmit, defineEmit,
useContext useContext,
useAttrs,
useSlots
} from './apiSetupHelpers' } from './apiSetupHelpers'
// Advanced API ---------------------------------------------------------------- // Advanced API ----------------------------------------------------------------

View File

@ -4,6 +4,8 @@ import {
defineEmit, defineEmit,
defineEmits, defineEmits,
useContext, useContext,
useAttrs,
useSlots,
withDefaults, withDefaults,
Slots, Slots,
describe describe
@ -134,3 +136,13 @@ describe('useContext', () => {
emit('foo') emit('foo')
emit('bar') emit('bar')
}) })
describe('useAttrs', () => {
const attrs = useAttrs()
expectType<Record<string, unknown>>(attrs)
})
describe('useSlots', () => {
const slots = useSlots()
expectType<Slots>(slots)
})