-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Unicode naming for methods seems unsupported. Some warning will be appreciated. #6975
Comments
You can try <button @click="改口()"></button> if you really want this. |
@javoski thanks. As I'm new to Vue, may I ask what's the difference between these two ways? |
It's just a workaround |
I don't think we can afford warning in runtime build, though :/ https://stackoverflow.com/a/9392578/2198656
|
As the alternative method suggested above does work, it just occurred to me that |
By tracking the click event, it looks like Vue does treat the Unicode names differently behind the scene, while the method name is like "doIt", button click invokes the "boundFn" directly, but when the method name is an Unicode name, the button invokes something like a "click event handler" instead:
|
In order to use the method name directly (shorthand) it needs to be a alphanumeric identifier. Any expression that is not an alphanumeric identifier is treated as a function body instead, which is why in this case |
Thanks for addressing this. Still, I wonder if some feedback could be provided in this case, maybe something like "You used a non-alphanumeric identifier. If it's intended, add () as a workaround."? |
The problem it's too expensive to detect "a non-alphanumeric identifier (maybe a unicode identifier)" from "a full expression" |
Excuse me if I miss something obvious. I realize it's too expensive to decide if an identifier is legit unicode identifier, as pointed out above. However I thought detecting if an identifier is non-alphanumeric is easier, like checking if it matches |
Version
2.5.2
Reproduction link
https://jsfiddle.net/p48cLbe3/2/
Steps to reproduce
What is expected?
Excuse me if this is closer to feature request.
It'll be great if method can support unicode naming. Otherwise it may be better to provide some feedback.
Thanks for your efforts.
What is actually happening?
I'm guessing validation passes because the method does exist, but somehow invoking method fails.
The text was updated successfully, but these errors were encountered: