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

113
Vistas
vuejs push checkbox values to URL

I am building a filter with vue js3. I want to push the user selected values to URL and I am watching changes in watch

My checkbox are not working, I have an array and I want to loop all course and make dynamic filter and push its value to URL. My select options are working and it push values to Url, My Url is like this: http://localhost:8080/filter?sort=latest when i choose latest from Url

I have few courses in array. I want to loop it and make a dynamic checkbox and when user checks it, i want to push it value to URL. I need this type of URL: http://localhost:8080/filter?sort=latest&course=php&course=js when user select latest, php and js options

So far I have done

    <h3>Choose multiple</h3>
        <div v-for="(name,index) in courses" :key="index">
            <input type="checkbox" v-model="filter.course" >{{name}}
       
       </div>

  
  
    </form>
</template>

<script>
export default {
    data(){
        return{

            courses:[],

            filter: {
                
                course:''
    
           }
        }
    },

    watch:{
        filter:{
            handler(){
            this.$router.push({
                query:this.filter
            })
            },
            deep:true
        }
    }
   
}
</script>

Only the problem here is i am not able to push checkbox values in the URL

Fixed: This was fixed by changing course:'' to array course:[]

about 4 years ago · Juan Pablo Isaza
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