Meituan-Dianping/mpvue · error

<${el.tag} v-model="${value}">: You are binding v-model dire

Error message

<${el.tag} v-model="${value}">: You are binding v-model directly to a v-for iteration alias. This will not be able to modify the v-for source array because writing to the alias is like modifying a function local variable. Consider using an array of objects and use v-model on an object property instead.

What it means

Dev-only warning from checkForAliasModel, invoked when the v-model directive is processed: v-model is bound directly to a v-for iteration alias (e.g. v-for="item in list" with v-model="item" on a primitive). Assignments write only to the loop-local alias and never propagate to the source array, so two-way binding silently fails.

Source

Thrown at src/compiler/parser/index.js:596

/* istanbul ignore next */
function guardIESVGBug (attrs) {
  const res = []
  for (let i = 0; i < attrs.length; i++) {
    const attr = attrs[i]
    if (!ieNSBug.test(attr.name)) {
      attr.name = attr.name.replace(ieNSPrefix, '')
      res.push(attr)
    }
  }
  return res
}

function checkForAliasModel (el, value) {
  let _el = el
  while (_el) {
    if (_el.for && _el.alias === value) {
      warn(
        `<${el.tag} v-model="${value}">: ` +
        `You are binding v-model directly to a v-for iteration alias. ` +
        `This will not be able to modify the v-for source array because ` +
        `writing to the alias is like modifying a function local variable. ` +
        `Consider using an array of objects and use v-model on an object property instead.`
      )
    }
    _el = _el.parent
  }
}

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Bind v-model to a property of objects in the array, e.g. v-model="item.text"
  2. Mutate the source array by index: use :value + @input="list[i] = $event" for primitives
  3. Restructure data as an array of objects so v-model writes to a property
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/compiler/parser/index.js:596 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/642158cd39dfe276. Report an issue: GitHub.