[Script Setup] Global directives collide with component's local vars
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
- Register a global directive, name it "focus" and listen for the callback.
- 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.
Early similar issues https://github.com/vuejs/vue-next/issues/3275, https://github.com/vuejs/vue-next/issues/3270
Finally I came up with the solution https://github.com/vuejs/vue-next/pull/3546