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 30 31 32 33 34 35 | 2x 2x 8x 8x 8x 8x 2x 6x 6x 8x 3x 1x 1x 1x 3x 5x 5x 3x 2x 1x 1x 3x 3x 1x 1x 1x 3x 3x 3x 1x 2x 8x | import { isArray, isObject, isString } from '@vue/shared' import { warn } from '@vue/runtime-core' export function ssrRenderList( source: unknown, renderItem: (value: unknown, key: string | number, index?: number) => void, ): void { if (isArray(source) || isString(source)) { for (let i = 0, l = source.length; i < l; i++) { renderItem(source[i], i) } } else if (typeof source === 'number') { if (__DEV__ && !Number.isInteger(source)) { warn(`The v-for range expect an integer value but got ${source}.`) return } for (let i = 0; i < source; i++) { renderItem(i + 1, i) } } else if (isObject(source)) { if (source[Symbol.iterator as any]) { const arr = Array.from(source as Iterable<any>) for (let i = 0, l = arr.length; i < l; i++) { renderItem(arr[i], i) } } else { const keys = Object.keys(source) for (let i = 0, l = keys.length; i < l; i++) { const key = keys[i] renderItem(source[key], key, i) } } } } |