No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Broken Q-Slider

    Help
    3
    5
    583
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      julioferraz last edited by

      Hi! The Slider seems to have some bug. The first time the Onreset method is rendered, it works, but when I change the value of the slide again it does not work. The following error appears:

      [Vue warn]: Error in v-on handler: “TypeError: $event.target is undefined”

      https://codepen.io/julioferraz/pen/VOBwmy

      <div class="text-h5" align="center">Test Slider</div>
      <br>
      <div align="center" id="q-app">
            
         <custom-slider v-model="val1"> </custom-slider>
         <q-btn v-on:click="onReset" label="Reset" color="red" />
         
      </div>
      
      Vue.component('custom-slider', {
        props: ['value'],
        template: `
          <q-slider
            v-model="value"
            :min= 0
            :max= 100
            label
            v-bind:value="value"
            v-on:input="$emit('input', $event.target.value)"
          />
        `
      })
      
      new Vue({
        el: '#q-app',
        data: function () {
          return {
           val1: 75
          }
        },
          methods: {
          onReset() {this.val1 = 25}
          }
      })
      

      Translated automatically

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        @input="val => { this.$emit('input', val) }" instead of v-on:input="$emit('input', $event.target.value)"
        You’re using a Vue component, not a native component.

        J 1 Reply Last reply Reply Quote 1
        • J
          julioferraz @rstoenescu last edited by

          @rstoenescu Worked, thank you! But I did not quite understand. The “q-slider” is not native?

          Automatically translated

          metalsadman 1 Reply Last reply Reply Quote 0
          • metalsadman
            metalsadman @julioferraz last edited by metalsadman

            @julioferraz said in Broken Q-Slider:

            @rstoenescu Worked, thank you! But I did not quite understand. The “q-slider” is not native?

            Automatically translated

            no it’s not, it’s a quasar component. you can also remove the v:bind part of your code, as you’ve already passed the value in your v-model.

            J 1 Reply Last reply Reply Quote 0
            • J
              julioferraz @metalsadman last edited by

              @metalsadman Of course. I understand. Thank you!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post