-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Child component cannot render when there is same named data. #3270
Comments
This is because the export function render(_ctx, _cache, $props, $setup, $data, $options) {
return (_openBlock(), _createBlock(_Fragment, null, [
_hoisted_1,
_createTextVNode(" " + _toDisplayString($setup.helloWorld) + " ", 1 /* TEXT */),
_createVNode($setup["helloWorld"], { msg: "Hello Vue 3 in CodeSandbox!" })
], 64 /* STABLE_FRAGMENT */))
} Here, |
Workaround: As long as the component name in the template is not the same as the binding, there will be ok. |
The source code clearly states that setup components take precedence over user components. Maybe it's not a bug, It's counterintuitive though. @HcySunYang |
This is not about component priority, it is about components/directives and data name conflicts |
Maybe it should be resolved in resolveComponent. |
Not sure if this is related, but if you have a child component named
or sometimes:
https://codesandbox.io/s/wonderful-meadow-p8nb6?file=/src/components/ParentComponent.vue I would say this is not necessary a minor bug, as the label suggests. I've ran into the situation twice already in a short period of time, trying to upgrade an existing vue 2 codebase. And with different console warnings, so had to investigate both times, a lot of time wasted. Imagine a production site having important parts of the page gone missing with no clue as to what is going on. |
Version
3.0.5
Reproduction link
https://codesandbox.io/s/divine-fog-7wep8?file=/src/App.vue
Steps to reproduce
Open this page
What is expected?
HelloWorld component rendered.
What is actually happening?
HelloWorld component do not render..
The text was updated successfully, but these errors were encountered: