-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Distinguishing multiple apps #1405
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
Comments
I think you didn't put names on your root component, so the devtools can't guess them? |
i am aware this might go beyond the focus of this repo, but could you please elaborate how to put a name on the root component? this is basically the way we mount the apps: import { createApp } from "vue";
import App from "./app.vue";
createApp(App).mount("#app"); |
Open your |
thanks a lot, i really was looking for this – maybe need new glasses 🤓 |
Doing this only changes the app's element tag name; e.g. import Vue from 'vue';
Vue.$mount({ name: 'FooBar' }); gives me a <FooBar>
...
</FooBar> leaving the Application name/ID as |
I've found a workaround, at least with Vue2 You will have to set the const app = new Vue({..., name: "This-Sets-Only-The-Root-Name"})
app.name = "This-changes-the-app-name-in-app-dropdown" Passing the name property to the constructor only changes the name of the "Root" component, which changes nothing about the App-Selector. But now, we can at least add the root-component name to the app-select dropdown: ...instead of the previous anonymous dropdown list: This is/was a real issue after upgrading to newer Vue Tools. I really really liked the old way, where all Root were shown in the component finder window:
But the workaround works for us now. |
@zealot128 It's not a workaround, it's how it's supposed to work. The selector takes the name of the root components.
This caused a lot of issues such as preventing supporting multiple vuex stores/routers on the same page, and wouldn't work with the timeline. |
@zealot128 this is a nice way to define a name dynamically – but in fact it does not work with vue3: const app = createApp(component, props);
app.name = name;
app.mount(selector); i am still seeing the name as defined in the sfc via the is there a way to do this in vue3, so i can assign different names for one and the same component used multiple times in the dom? |
const app = createApp({ ...component, name: 'foo' }, props) |
ah of course! perfect, thanks @Akryum |
I guessed so after reading Only the typings of Vue do not allow a "name" here, so it is not obvious that a "name" can be applied here: Nevertheless, it now works good with the name property! Future Googler's can find this post. Or maybe it is possible to add a hint in the box if one has more than one "App" on the bottom of the mouse wheel hint? Like a link to this issue or a modal with explanation of adding the name property to a Vue instance to change the name, maybe. |
You need to put it in the options of the root component. |
No, that didn't work, at least here with our Vue 2 setup. Setting the |
Hmm looks like an issue then |
So the intended way is to put a |
@Akryum perfect! Thank you for the quick fix! |
Vue3 project has this issue as well. |
vue3 project has this issue too, |
Version
6.0.0-beta.7
Browser and OS info
Chrome 89 / Ubuntu 18.04
Steps to reproduce
What is expected?
A list of application names easily to be distinguished is displayed (e.g. Header, Footer, Tooltip).
What is actually happening?
A list of similar application names is displayed (e.g. App 1, App 2, App 3)
Here is a screenshot: https://pasteboard.co/JXpLdoH.png
The text was updated successfully, but these errors were encountered: