Meituan-Dianping/mpvue · error

<${el.tag} v-for="${alias} in ${exp}">: component lists rend

Error message

<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.

What it means

Error "<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info." thrown in Meituan-Dianping/mpvue.

Source

Thrown at src/compiler/codegen/index.js:180

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 (process.env.NODE_ENV !== 'production' &&
    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://vuejs.org/guide/list.html#key for more info.`,
      true /* tip */
    )
  }

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

export function genData (el: ASTElement, state: CodegenState): string {
  let data = '{'

  // directives first.

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Add an explicit :key to the component rendered with v-for
  2. Use a stable unique identifier rather than the array index
  3. Keys are only warned for components/slot/template-tag-adjacent cases, not plain elements
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/compiler/codegen/index.js:180 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02). Data as JSON: /api/errors/1b3397f15e2d8d64. Report an issue: GitHub.