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

Error "<${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." thrown in Meituan-Dianping/mpvue.

Source

Thrown at packages/weex-template-compiler/build.js:1908

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

function checkForAliasModel (el, value) {
  var _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;
  }
}

/*  */

var isStaticKey;
var isPlatformReservedTag;

var genStaticKeysCached = cached(genStaticKeys$1);

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Bind v-model to a property of the source array's objects, e.g. v-model="item.name" on objects instead of the alias itself
  2. Mutate the original array (this.list[i].value = x) rather than the iteration alias
  3. Wrap primitives in objects: use an array of { value } entries so v-model can write to a property
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/weex-template-compiler/build.js:1908 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/682f0242d461bb91. Report an issue: GitHub.