Skip to content

cannot watch unicode properties like 'a.中文' #8862

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

Closed
ensleep opened this issue Sep 29, 2018 · 9 comments
Closed

cannot watch unicode properties like 'a.中文' #8862

ensleep opened this issue Sep 29, 2018 · 9 comments

Comments

@ensleep
Copy link

ensleep commented Sep 29, 2018

Version

2.5.17

Reproduction link

https://jsfiddle.net/k72f3Lon/

Steps to reproduce

1.webpack project with vue .
2.add a component .
3.create instance of Vue .
4.add a property data:function(){return {a:{中文:"",b:""}}} to the instance.
5.add watch properties to the instance as watch:{'a.b':function(val){},'a.中文':function(val){}}
6.console show error that Watcher only accepts simple dot-delimited paths.

What is expected?

no error the code run continue

What is actually happening?

the code seems stopped to run

@posva
Copy link
Member

posva commented Sep 29, 2018

Next time take the time to add the repro (which I added)

@posva posva changed the title Watch Property with 'a.中文' occur Watcher only accepts simple dot-delimited paths. cannot watch unicode properties like 'a.中文' Sep 29, 2018
@Shyam-Chen
Copy link
Contributor

Shyam-Chen commented Oct 1, 2018

screen shot 2018-10-25 at 9 24 42 am

@angelina999990
Copy link

@lujiaxing
Copy link

Use chinese as a key is nonstandard. We strongly recommend that use latin characters english words as a key.

@yumao233
Copy link

But in some cases, we still need to use Chinese characters as keys. Such as username key-value pairs.

@g-plane
Copy link
Contributor

g-plane commented Dec 4, 2018

Though using Chinese as key is strange, as a framework/library, it must consider all edge cases. It's not related to best practices.

@ensleep
Copy link
Author

ensleep commented Dec 5, 2018

Although I also think that characters other than the underscore of English data should not be used as attributes, sometimes the interface provided by the third party, in order to reduce the complexity of docking, will directly give the JSON format data whose attributes are named in Chinese. At the time of binding, there was trouble.

@willvincent
Copy link

I believe this should have been referenced as being closed by #8666

@posva
Copy link
Member

posva commented Jan 25, 2019

Indeed, this was added there and should be on 2.6
Thanks for notifying us!

@posva posva closed this as completed Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants