Answer the question
In order to leave comments, you need to log in
A couple of questions about the SPA?
Hello, 2 simple questions from a newbie. I decided to learn vue.js and start building proper single page apps. I think that the js framework is not particularly important here, I'm interested in the approach.
Question 1: I have a different layout structure on different pages. For example, on the main three-column interface, on some it’s just a block with text, on some it’s a full-width horizontal menu.
Actually, as I understand it, there are two ways to manage the page:
The first way is to create one single container and initialize one vue object. More or less like this:
<div id="app"></div>
<script>
new Vue({
el : '#app'
});
</script>
<div id="left-menu"></div>
<div id="content"></div>
<script>
new Vue({
el : '#left-menu'
});
new Vue({
el : '#content'
});
</script>
Answer the question
In order to leave comments, you need to log in
1. There is no pattern standard in vue yet, but if it's wise, then the application should always have one main component. The component approach is very flexible and convenient. For different pages (components), use a router.
For the state, there is vuex or the same hype redux
2. It is not entirely clear who gives what to whom. At you a static from the server gives a larka? Starting from 2.3.3, ssr (side rendering server) started working right out of the box, but not all life cycle hooks are more accurately present there.
2. In theory, search robots can track it. Giving different pages to search engines and clients is a terrible crime in terms of SEO.
Although, maybe there is some legal way to show that this is a SPA to a search engine. I heard that there seems to be something, but not the fact that it will still work correctly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question