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

    v-money in input

    Framework
    4
    12
    3730
    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.
    • D
      dwms last edited by

      I’m using v-money in quasar input, it turns out that when I try to change the value of the model on a click of the button, the value is not changed in the quasar component! In a normal input the change is made normally.

      1 Reply Last reply Reply Quote 0
      • G
        genyded last edited by

        Quasar components (QInput, etc) are literally Vue components, not html elements as many seem to think. As such, you have to treat them a bit differently. If you can paste a snippet or link to a fiddle of your code that show the components/elements and what your button click does, we can to help get it working for you. You’ll likely need to manually do similar to what v-model does automatically and instead use events to get and set the value.

        1 Reply Last reply Reply Quote 0
        • D
          dwms last edited by

          Can you give me an example?

          1 Reply Last reply Reply Quote 0
          • G
            genyded last edited by

            Paste your current code as requested so we have apples to apples.

            1 Reply Last reply Reply Quote 0
            • D
              dwms last edited by dwms

              I have the input

              <q-field>
              <q-input v-model=“notaItem.objeto.attributes.qCom” type=“text” stack-label=“Qtd” v-money=“money”/>
              </q-field>

              It’s simple, in any method I try to execute

              this.notaItem.objeto.attributes.qCom = ‘1,000’

              but nothing happens to the value shown in the input

              1 Reply Last reply Reply Quote 0
              • G
                genyded last edited by

                Is there a data object or computed property for notaItem.objeto.attributes.qCom> Or least for notaItem and if only this, is it a JS object? That is why I asked for your code (twice now), obviously you are using an input but how are all the other pieces glued together?

                1 Reply Last reply Reply Quote 0
                • Underzzoo
                  Underzzoo last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • D
                    dwms last edited by

                    Yes, notaItem is simply a JS object

                    1 Reply Last reply Reply Quote 0
                    • G
                      genyded last edited by

                      Why can’t you just paste your code or make a fiddle? Then we don’t have to play 20 questions. Is it a JS object on the data function, in the store, computed, or other? What about the method to set it? If you cannot provide some detail, I am not going to spend more time trying to help.

                      1 Reply Last reply Reply Quote 0
                      • D
                        dwms last edited by Shone

                        my code is too long, I’ll only put the piece

                        data ()  {
                            return {
                              notaItem: {
                                objeto: {
                                  type: 'nota_item',
                                  attributes: {
                                    qCom: 0
                                  }
                                }
                              }
                            }
                          }
                        
                        
                        methods: {
                          selectItem () {
                              this.notaItem.objeto.attributes.qCom = 10
                            }
                        }
                        
                        1 Reply Last reply Reply Quote 0
                        • G
                          genyded last edited by genyded

                          If you put triple backticks (```) at the top and bottom of your code in this forum, it will format it and it will be much easier to read. Also, you cannot update an object directly, you have to either use Vue’s $set or a JS objectAssign (or something similar). Last but not least, If you read the v-money docs, they state that you MUST use lazy if using it as a directive. Vue does not support lazy on components (yet). You really may want to take a base JS and/or Vue course before trying to use Quasar.

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

                            Also some additional advice. If you code and expect help outside of your own team (who speak a different language than English), you should write your code purely in English too. Your current example is understandable, but it could be that context gets lost with naming in a foreign language, which hinders others trying to help you/ your team. 😄

                            Scott

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