How to get the dom element from quasar events, or send/read additional params



  • Take for example:

    <div v-for="u in users">
      <span>
        {{ u.id }} 
        <q-select v-model="u.color" :options="colorsList" @change="edit"/>
      </span>
    </div>
    

    and

    methods: {
        edit (x) {
          console.log(x)
        }
    

    When the select change, the console.log will print the correct new value of colorsList and the model will change, everything normal until here, but in this scenario, how will I know which user the color has changed?

    1. If i can access the dom-element, i could put something like :data-helper="u.id in the q-select to access it later in the edit function
    2. I could create a copy of users, watch for changes and compare with the copy to find what changed, but its look to much
    3. Every span could be a child component so the change event would have its own user/scope, but again, its look to much for a simple thing

    Something like @change="edit(u.id) and then on methods edit (x, myCustomID), so it would keep the default attribute x from quasar and any extra parameters too


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.