quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.65k stars 3.47k forks source link

q-toggle @update not working #12454

Closed fairking closed 2 years ago

fairking commented 2 years ago

What happened?

Having this doc: https://quasar.dev/vue-components/toggle

The q-toggle is not working as expected. the event @update is not triggered. https://jsfiddle.net/3dr6n0qv/

What did you expect to happen?

working @update event

Reproduction URL

https://jsfiddle.net/3dr6n0qv/

How to reproduce?

Click toggle

Flavour

Quasar CLI (@quasar/cli | @quasar/app)

Areas

Components (quasar)

Platforms/Browsers

Other

Quasar info output

No response

Relevant log output

No response

Additional context

No response

github-actions[bot] commented 2 years ago

Hi @fairking! 👋

It looks like you provided an invalid or unsupported reproduction URL. Do not use any service other than Codepen, jsFiddle, Codesandbox, and GitHub. Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc. Please edit your original post above and provide a valid reproduction URL as explained.

Without a proper reproduction, your issue will have to get closed.

Thank you for your collaboration. 👏

fairking commented 2 years ago

Hi @fairking! 👋

Without a proper reproduction, your issue will have to get closed.

Thank you for your collaboration. 👏

what? could someone please disable that bot :-)?

fairking commented 2 years ago

I can see the function:

  function onClick (e) {
    if (e !== void 0) {
      stopAndPrevent(e)
      refocusTarget(e)
    }

    if (props.disable !== true) {
      emit('update:modelValue', getNextValue(), e)
    }
  }

But I cannot understand what it is doing? on click we trigger update? what if I need to listen to click itself? click and update are two different things I assume. Anyway those were just my thoughts.

gregadro commented 2 years ago

There is no such event with that name. The correct event name is @update:model-value, also seen from the code snippet above. So in your CodePen you should use @update:model-value="onUpdate".

fairking commented 2 years ago

oh nice, I came from the vuejs2 world. So apologize for any misunderstanding. Closing the issue.

fairking commented 2 years ago

Comparing the code against f7 or even ionic I can see the Quasar is more mature and focused on vue only 👍. Thanks.

fairking commented 2 years ago

I'll reopen the issue just for one small question, if you don't mind.

The only small issue I can see with those events. Why do we need @update:model-value in a first place instead of just @update? I can see a huge issue if you lets say rename some of the model value name to @update:model-start-date all users will have problems without noticing (events will just simply stop working). I guess there is no compiler validation against model value names in events. What do you think guys? I feel like first the model-value is unnecessary and the second it creates extra job with keeping this model-value names in sync. Unless I missing something important why they required.