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

[Script Setup] Global directives collide with component's local vars #3543

Closed
Sikarii opened this issue Apr 5, 2021 · 3 comments
Closed

[Script Setup] Global directives collide with component's local vars #3543

Sikarii opened this issue Apr 5, 2021 · 3 comments

Comments

@Sikarii
Copy link

@Sikarii Sikarii commented Apr 5, 2021

Version

3.0.11

Reproduction link

CodeSandbox will work as expected, as it's seemingly unable to parse the new script setup syntax:
https://codesandbox.io/s/amazing-sun-nn9zt

Steps to reproduce

  1. Register a global directive, name it "focus" and listen for the callback.
  2. Create a SFC with the experimental "script setup" syntax and declare a variable with the same name as the global directive (focus).

What is expected?

The directive callback would be called.

What is actually happening?

The component's local variable seems to override the global directive, thus the callback never firing.

@HcySunYang
Copy link
Member

@HcySunYang HcySunYang commented Apr 6, 2021

This seems inevitable, maybe we need to provide an appropriate warning message for this

@HcySunYang
Copy link
Member

@HcySunYang HcySunYang commented Apr 6, 2021

Early similar issues #3275, #3270

@HcySunYang
Copy link
Member

@HcySunYang HcySunYang commented Apr 6, 2021

Finally I came up with the solution #3546

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

Successfully merging a pull request may close this issue.

3 participants