[Vuejs]-How to convert Jquery line of codes into vue

0👍

You don’t need to convert anything. You just need to read the first few chapters in the Vue documentation.

var app = new Vue({
  el: '#app',
  data() {
    return {
      active: 1,
      step: ['step 1', 'step 2', 'step 3'],
    }
  },
})
.activeClass{
  color: red;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
  <ul>
    <li
      v-for="(items, index) in step"
      :key="items"
      :class="(index === active) ? 'activeClass' : ''"
      v-text="items"
    />
  </ul>
</div>

Leave a comment