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
  6f9060e9_4d2c_0a9f_e876_7334660278e7["genFor()"]
  55398ede_0597_fb47_dd8c_edb8c5aacdad["genSSRElement()"]
  55398ede_0597_fb47_dd8c_edb8c5aacdad -->|calls| 6f9060e9_4d2c_0a9f_e876_7334660278e7
  4d0b6945_0b17_a914_402c_b134ebc6a88e["elementToSegments()"]
  4d0b6945_0b17_a914_402c_b134ebc6a88e -->|calls| 6f9060e9_4d2c_0a9f_e876_7334660278e7
  ce806ab8_847b_273b_e07c_0a796c2f76ae["genElement()"]
  ce806ab8_847b_273b_e07c_0a796c2f76ae -->|calls| 6f9060e9_4d2c_0a9f_e876_7334660278e7
  d777a689_36b5_fe7e_de7e_1c8af4474401["genScopedSlot()"]
  d777a689_36b5_fe7e_de7e_1c8af4474401 -->|calls| 6f9060e9_4d2c_0a9f_e876_7334660278e7
  style 6f9060e9_4d2c_0a9f_e876_7334660278e7 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)}` +
    '})'
  )
}

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