1

I using Vuejs and have some variable for filter.

data() {
    return {
      startDate: new Date(),
      startTime: new Date(),
      endDate: new Date(),
      endTime: new Date(),
      step: 0
    }
}

I want watch status of variable above, when change to send request get new Data I using:

watch: {
    startDate() {
      this.filterChange()
    },
    startTime() {
      this.filterChange()
    },
    endDate() {
      this.filterChange()
    },
    endTime() {
      this.filterChange()
    },
    step() {
      this.filterChange()
    }
  }

But syntax too long. When i have more variable it same

...varibale() { this.filterChange() }

How to short syntax?? Example in react

useEffect(()=>{
  ...balabal
},['var1, 'var2'...])

Thank you everyone!

0 Answers0