-
Notifications
You must be signed in to change notification settings - Fork 546
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
Use slots on router-view to display an initial placeholder instead of an empty node #80
Conversation
Sounds like a great idea. An issue I've faced is that you're still waiting for the app to load before it can do anything. What I've done instead is add the minimum css and html by hand to the index page for showing a splash screen or loading indicator and then once the initial route is rendered I'll hide them. When using a loading indicator, it's generally also a component, but since I can't wait for the framework and my app to load, I have to copy/paste the necessary code from the component to the index page to get the fastest time to render so possibly a plugin would be really handy that could do this instead so that imports and sass and such things could still be used. |
Hello @posva, sorry for bumping this 3 months-old PR. Was wondering if you're ok with this RFC? So that I can proceed with vuejs/vue-router#2799. Thank you. |
@briwa Sorry, but we are not sure this is the direction we want to go yet. So please, don't add more commits to the PR. We will come back at you when we can |
If you check <router-view v-if="$route.matched.length"/>
<loading-view v-else/> Or by comparing to the initial location (vuejs/vue-router#2718) <router-view v-if="$route !== START"/>
<loading-view v-else/> Apart from a builtin way to handle this, why would using the default slot better? Having it as a default makes it impossible to escape, which could be problematic for Declarative Routing (adding routes as we enter a View) |
Thanks a lot for the RFC. I'm closing this for the reasons mentioned above and because this can be achieved with #153 which has a broader intention. So far this has only been implemented on router v4 but It will likely be ported back to router v3 as well |
TL;DR: There should be a way to render something on the browser, instead of an empty node, when
vue-router
has just been initialized.Rendered