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

    Q-Rating value undefined

    Help
    2
    3
    147
    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.
    • S
      stefanopav last edited by

      Hello,

      here I am building one application by using quasar framework.

      I am using Q-Rating component, but it is returning undefined instead the selected value.

      Component inside template

      <q-rating
           v-model="defaultRating"
           size="2em"
           :max="10"
           color="primary"
           @click="clickOnRating" />
      

      Function 'clickOnRating’

      clickOnRating (evt, value) {
            evt.preventDefault()
            console.log(value)  // logs 'undefined'
          }
      

      What am I doing wrong?

      Thank you in advance,
      Stefano

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by s.molinari

        @click is a native event and native events only offer the event object, unless otherwise modified by Quasar (see the API). There is no value offered with @click. What you are probably looking for is the @input event. That event gives you only the value. You can also use @click and just take the value of v-model at that point in time too.

        See here for working example: https://codepen.io/smolinari/pen/QWjKjZE

        8c7e59f8-8283-46a9-8b0a-81ec9bc7c7d3-image.png

        Scott

        1 Reply Last reply Reply Quote 0
        • S
          stefanopav last edited by

          I was convinced about using it… too many hours of coding!

          Thank you

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