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

108
Views
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
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!