Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event listeners do not work #26

Closed
LucaRainone opened this issue Dec 14, 2017 · 3 comments
Closed

Event listeners do not work #26

LucaRainone opened this issue Dec 14, 2017 · 3 comments
Assignees
Labels

Comments

@LucaRainone
Copy link
Contributor

From doc, the Calendar component should accept @daySelect and @update:fromPage listeners

But this code does not works

    <v-calendar @daySelect='selectDay' @update:fromPage="selectDay"> </v-calendar>
<script type="text/javascript">
	new Vue({
		el     : '#app',
		data   : {
			// Data used by the date picker
			mode        : 'single',
			selectedDate: null,
		},
		methods: {
			selectDay: function () {
				console.log(arguments);
			}
		}
	});
</script>

The method selectDay is never called
It seems that the problem is the case sensitive event name.

[Vue tip]: Event "dayselect" is emitted in component but the handler is registered for "daySelect". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "day-select" instead of "daySelect".

Using @day-select does not resolve. I think that the event name should be "dayselect", "update:frompage", "update:topage".

@nathanreyes
Copy link
Owner

nathanreyes commented Dec 15, 2017

v0.4.2 is released. Let me know if you have any issues with the fixes.

@paulg446
Copy link

I'm experiencing this issue too. v0.6.3. Listening for @update:topage, which works fine, but I get the following warning each time the event emits:

[Vue tip]: Event "update:topage" is emitted in component but the handler is registered for "update:toPage". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "update:to-page" instead of "update:toPage".

It's just a warning, but it's better if it can be avoided. I've tried update:to-page but that doesn't catch the event.

@nathanreyes
Copy link
Owner

This issue has been kind of a pain to manage. The reason that both events are emitted (update:frompage and update:fromPage) is because in order to use the :from-page.sync feature, I have to emit update:fromPage. Neither raising update:frompage nor update:from-page will support using .sync with the from-page prop.

I could drop emitting update:fromPage and update:toPage events, but using the .sync feature with these props would not be supported.

I think the only solution would be to rename all props to using their non-camelcase versions (from page and topage) but I feel that would be a pretty big breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants