cklmercer / vue-events

Simple event handling for Vue.js
MIT License
234 stars 27 forks source link

Events options not registering on Vue 2.2.1 #8

Closed dvatp closed 7 years ago

dvatp commented 7 years ago

While experimenting with:

https://github.com/ratiw/vuetable-2-tutorial-bootstrap/tree/master/src

and running Vue 2.2.1 (latest as of this date).

This is basically a Vue equivalent to the DataTables jquery plugin that uses vue-events. In simple terms, this consists of a Vuetable component which displays some data in a table and a FilterBar component which allows the user to enter some search criteria (free-form text).

The FilterBar is organized as a child of the Vuetable component. When the user types data into the search field and clicks "go" a custom event called "filter-set" is emitted. The parent Vuetable component uses vue-events to listen to that event and fetch new data and reload the table.

The problem is that, although the FilterBar is in fact emitting the event, the Vuetable component would not respond to the event and reload the table.

I traced the problem to a conditional in vue-events (index.js) that is apparently trying to determine whether the installation is Vue 1.x or 2.x. When I comment out that conditional and just let the Vue.mixin() call run, everything works.

I'm new to Vue so I don't fully understand Vue internals in depth yet, but it's clear something has changed such that Vue.prototype._mount does not exist (or more technically isn't considered a function) so the test fails and nothing is registered. That logic needs some work.

cklmercer commented 7 years ago

Thank you for the detailed bug report!

I've published a new version of vue-events which removes the conditional. That conditional was probably unnecessary, given that Vue 1.0 doesn't even use the beforeCreate life-cycle hook.

dvatp commented 7 years ago

Thanks for the rapid fix. FYI, I pulled in vue-events via npm, so if you are pushing out a package as part of this process I'll update and verify the fix.

cklmercer commented 7 years ago

I did indeed publish the new version to npm. 3.0.1 is the current latest. Verification would be much appreciated!

dvatp commented 7 years ago

Updated via npm and verified the fix works. Little more than a half hour from initial report, to fix, to integration test of the fix. This is how open-source should be done. Thanks again!