[Vuejs]-How do you change the position of a component to keep it same as the v-model it's bound to?

0👍

Waching a computed property is generally a better idea.

Vue.use(Vuetify);

var vm = new Vue({
  el: "#app",

  data: {
    dummyData: [1, 0]
  },
  methods: {
   doThis() {
      if (this.dummy > 0) {
        this.dummyData[0] = 5
      } 
   }
  },
  watch: {
    dummy: "doThis"
  },
  computed: {
   dummy () {
     return this.dummyData[1];
   }
  }
});

EDIT:

<v-slider
  v-model="dummyData[index]"
  :min="0" :max="5" type="numbers" single-line hide-details 
  :class="{'no-pointer-events': index === 0 && dummyData[index + 1] > 0}">
</v-slider>

.no-pointer-events {pointer-events: none}

Leave a comment