Case when v-if v-else throws error and breaks app #4393

kamax1 opened this Issue Dec 6, 2016 · 1 comment


None yet

3 participants

kamax1 commented Dec 6, 2016 edited

Here is an example


    <template v-if="false">
    <template v-else>
      <div v-if="condition" class="my-class">I'm loading</div>
      <div v-else>I'm loaded</div>

If v-if v-else block nested into another v-if, it produces error

VM205 vue.js:427TypeError: Cannot read property 'attrs' of undefined

when switching value of condition.

As i researched, need 3 conditions to reproduce the issue

  1. Class attr (or another attribute) must be presented presented in nested element
  2. Nested v-else must be presented
  3. v-if v-else must be nested into another v-if v-else

Workaround is to use v-if="condition" and v-if="!condition" instead of v-else


@yyx990803 yyx990803 added 2.x bug labels Dec 6, 2016
@yyx990803 yyx990803 closed this in 58949bd Dec 8, 2016

after the latest update 2.1.4 still facing the problem. For now using the workaround that @kamax1 described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment