[Vuejs]-Vuetify stepper Load a component based on the state

1👍

The simple way is put v-if on the component tag to check state is equal components step

<v-stepper-content step="1">
  <generalBooks v-if="state >= 1" :url="url" />

But this way when client back to the lower steps the component rerender again, another way is watch over state to check step and save loaded components name in an array and recheck array with current component name in in v-if or
save highest State client watched so componenet already loaded

<v-stepper-content step="1">
  <generalBooks v-if="highestState >= 1" :url="url" />
data(){
  state: 1,
  highestState: 1,
},
watch: {
  state(val){
    if(val > this.highestState) this.highestState = val;
  },
}
👤Mohsen

Leave a comment