I have an accordion list, where I’d like to add a check condition to each item, which decides whether to allow the accordion to open or not. If the condition fulfills, then there’s one futher step: I’d like to invoke an ajax call to get the content data of the accordion. As I see the accordion’s code, there’s no such event (beforeOpen or anything like that).
Is there a way to achieve a result like this?
Probably I’m totally misunderstanding how it should go, but if using this code: @accordion:beforeopen="onBeforeOpen(item, $prevent)"
I get the following (fairly clear) error message: [Vue warn]: Property or method "$prevent" is not defined on the instance but referenced during render.
Thanks, it was perfectly clear. I had two problems: first, as I wrote, e is not the event object, but only the prevent function reference - thus it doesn’t have a target prop. I fixed it in this PR.
On the other hand, if I get the event object in the eventhandler, than I lose the bound item object reference - even though it would be useful. This can be worked around by binding it’s certain properties to DOM dataset items which are necessary in the eventhandler to decide whether the open action should be prevented or not.
If there’s a more elegant way (e.g. passing both the event and the item instance as args), please let me know.