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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directive function syntax throws an error #3243

Closed
chrisvfritz opened this issue Jul 7, 2016 · 2 comments
Closed

Directive function syntax throws an error #3243

chrisvfritz opened this issue Jul 7, 2016 · 2 comments
Labels

Comments

@chrisvfritz
Copy link
Contributor

chrisvfritz commented Jul 7, 2016

EDIT: Turns out this syntax is not deprecated, it just needs to be fixed. 馃槂

When using this deprecated directive syntax:

Vue.directive('my-directive', function (value) {
  // this function will be used as update()
})

The errors thrown are:

vue.js:2168 [Vue warn]: Error during component render (found in root instance)
vue.js:3479 Uncaught TypeError: Bind must be called on a function

These are pretty vague, so wasn鈥檛 sure if we wanted to throw a better warning, similar to when users don鈥檛 have a root element in their template for example. Maybe something like:

[Vue warn]: Directive definition must be an object (Function definition is deprecated)
@yyx990803
Copy link
Member

Hmm, the function shorthand should still be supported. This seems like a bug.

@chrisvfritz chrisvfritz changed the title Better warning for deprecated function directive definition syntax Directive function syntax throws an error Jul 7, 2016
@chrisvfritz
Copy link
Contributor Author

@yyx990803 Good to know! Edited the issue. The reason I thought it was deprecated is because update is no longer called after bind, which seemed to eliminate the use case for this feature. Or is that a bug too?

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

2 participants