Home / Function/ genFor() — vue Function Reference

genFor() — vue Function Reference

Architecture documentation for the genFor() function in index.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  57deee28_aac6_0fbe_7eff_db2c78f58dbf["genFor()"]
  c9c89a7e_a7ef_371a_0bb1_ccb05926e1f2["genSSRElement()"]
  c9c89a7e_a7ef_371a_0bb1_ccb05926e1f2 -->|calls| 57deee28_aac6_0fbe_7eff_db2c78f58dbf
  e2a158d6_845c_6930_8656_68576142a273["elementToSegments()"]
  e2a158d6_845c_6930_8656_68576142a273 -->|calls| 57deee28_aac6_0fbe_7eff_db2c78f58dbf
  4cfaef88_0bc8_30fc_0a01_09b4149fd58c["genElement()"]
  4cfaef88_0bc8_30fc_0a01_09b4149fd58c -->|calls| 57deee28_aac6_0fbe_7eff_db2c78f58dbf
  957c0d47_da61_bbd7_c2c0_6ec005373124["genScopedSlot()"]
  957c0d47_da61_bbd7_c2c0_6ec005373124 -->|calls| 57deee28_aac6_0fbe_7eff_db2c78f58dbf
  style 57deee28_aac6_0fbe_7eff_db2c78f58dbf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/codegen/index.ts lines 241–275

export function genFor(
  el: any,
  state: CodegenState,
  altGen?: Function,
  altHelper?: string
): string {
  const exp = el.for
  const alias = el.alias
  const iterator1 = el.iterator1 ? `,${el.iterator1}` : ''
  const iterator2 = el.iterator2 ? `,${el.iterator2}` : ''

  if (
    __DEV__ &&
    state.maybeComponent(el) &&
    el.tag !== 'slot' &&
    el.tag !== 'template' &&
    !el.key
  ) {
    state.warn(
      `<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with ` +
        `v-for should have explicit keys. ` +
        `See https://v2.vuejs.org/v2/guide/list.html#key for more info.`,
      el.rawAttrsMap['v-for'],
      true /* tip */
    )
  }

  el.forProcessed = true // avoid recursion
  return (
    `${altHelper || '_l'}((${exp}),` +
    `function(${alias}${iterator1}${iterator2}){` +
    `return ${(altGen || genElement)(el, state)}` +
    '})'
  )
}

Domain

Subdomains

Frequently Asked Questions

What does genFor() do?
genFor() is a function in the vue codebase.
What calls genFor()?
genFor() is called by 4 function(s): elementToSegments, genElement, genSSRElement, genScopedSlot.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free