I
I
Ivan2018-07-13 15:28:23
Vue.js
Ivan, 2018-07-13 15:28:23

How to apply vue router for start page?

There is a start page with a logo and a "Go to site" button in the center of the screen. By clicking on the "Go to site" button, the user is taken to a regular site with a header, sidebar, etc. If I did this without vue.js the route would look like this: intro.html -> index.html But I want to implement this using vue router/spa. From the documentation, I realized that the links need to be wrapped in the router-link tag, and the content should be displayed in the router-view. This would work great if the links always stayed in place, like in a sidebar, and the content loaded in the correct area on the page. But here the situation is completely different - you need to redraw the entire page, remove the "Go to site" button. This makes me think of wrapping the router-link in a router-view, but I'm sure that would cause recursion, so it doesn't fit.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2018-07-13
@ivanxpru

This makes me think of wrapping the router-link in a router-view, but I'm sure that would cause recursion, so not appropriate

Well, there's nothing stopping you from trying.
Something like this, but on full-fledged components: https://codepen.io/anon/pen/YjyZam

A
Anton Shvets, 2018-07-13
@Xuxicheta

I didn’t understand anything, who’s stopping you from placing a router-link even in the sidebar, even inside the component. The main thing is that they are in the scope of vue.
If outside of Vue, then you will have to put vm.$router.go on the links.
outer-view is just an html element into which the components specified by the router will be rendered.
The same component, only more complex.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question