Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Vue Watchers for multiple button clicks

I have multiple filters that are set to false and if clicked turn to true and must implement the specific filter. How can I use a watchers to look for the changing of my filter from false to true. Currently as I have all my functions in one watcher if one filter is clicked all filters are implemented. Whereas I need it to be only the specific filter that is related to the filter button.

<sankey-filter
    label="string1"
    v-model="filters.string1"
      />
  <sankey-filter
    label="string2"
    v-model="filters.string2"
      />
  <sankey-filter
    label="string3"
    v-model="filters.string3"
      />


data() {
  return {
      filters: {
        statusString1: false,
        statusString2: false,
        statusString3: false,
      }
 watch: {
    filters: {
      handler: function(){
        this.filterString1(),
        this.filterString2(),
        this.filterString2(),
      },
      deep: true
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Use a dot-delimited path as the watcher key.

watch: {
    'filters.string1' () {
       this.filterString1(),
     },
    'filters.string2' () {
       this.filterString2(),
     },
    'filters.string3' () {
       this.filterString3(),
     },
}
about 4 years ago · Juan Pablo Isaza Report

0

Vue $watch provide callback function two parameters (newValue, oldValue) so U can check new value each filter if true for each filter action

watch: {
    filters: {
      handler: function({statusString1, statusString2, statusString3}){
        if (statusString1)
           this.filterString1()
        if (statusString2)
           this.filterString2()
        if (statusString3)
           this.filterString3()
      },
      deep: true
    }
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!