Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda