Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 2x 2x 140x 140x 140x 140x 2x 255x 255x | import { type ComponentInternalInstance, getCurrentInstance, } from '../component' import { warn } from '../warning' export function useId(): string { const i = getCurrentInstance() if (i) { return (i.appContext.config.idPrefix || 'v') + '-' + i.ids[0] + i.ids[1]++ } else if (__DEV__) { warn( `useId() is called when there is no active component ` + `instance to be associated with.`, ) } return '' } /** * There are 3 types of async boundaries: * - async components * - components with async setup() * - components with serverPrefetch */ export function markAsyncBoundary(instance: ComponentInternalInstance): void { instance.ids = [instance.ids[0] + instance.ids[2]++ + '-', 0, 0] } |