[Vuejs]-Laggy Vuetify v-checkbox

3๐Ÿ‘

Iโ€™m not at all good with Vue, so this could be bad practice, but it seems like if you manage the data yourself it has much better performance:

https://codepen.io/element13/pen/qBNweqx

new Vue({
  vuetify: new Vuetify(),
  data: () => ({
    values: new Array(500).fill(0),
    selected: []
  }),
  methods: {
    toggle: function(index) {
      if (this.selected.includes(index)) {
        this.selected.splice(this.selected.indexOf(index), 1);
      } else {
        this.selected.push(index)
      }

    }
  }
}).$mount("#app");

<div id="app">
  <v-app>
    <div v-html="Array.from(selected)"></div>
    <div v-for="(x, index) in values"><v-checkbox @change="toggle(index)" :value="index"></div>
  </v-app>
</div>
๐Ÿ‘คdave

Leave a comment