[Vuejs]-Mapping Array into Elements with v-for into html attribure

0👍

Your syntax is off; Don’t use {{}} in attributes, use v-bind directive or : for short:

<ul id="example-1">
  <li v-for="item in items">
    <div v-bind:class ="item.message">
    </div>
  </li>
</ul>

or simpler:

<ul id="example-1">
  <li v-for="item in items">
    <div :class ="item.message">
    </div>
  </li>
</ul>

Leave a comment