voie
voie copied to clipboard
Static Html inside div root?
I was wondering if there was a way to have static html in the home root view? I am using some php and want the initial page to render. Then have links to the states on that home page. Does that make any sense at all? I have tried a number of different ways with no success.
Well, as Vue is generally not very prerender-friendly, so it was never a purpose of Voie to address prerendering in any way. State manager basically replaces its root
element with rendered view hierarchy once ready, so there is currently no way to hook up existing page templates with Voie. However, if you have some ideas in mind on how this could be implemented, I'll be happy to discuss them.
That being said, you can still have regular links with href
s pointing to your application routes outside root
element, e.g.:
<nav>
<a href="/users">Users</a>
<a href="/groups">Groups</a>
</nav>
<div id="app">
</div>
The disadvantage is obvious: full page reload on click, but it also occurred to me that you can expose your state manager singleton to global namespace and have onclick
handlers like app.go({ name: 'users' }); return false;
. Looks a bit hack-ish to me though :confused:
You see the problem with your example above is that the nav section would still be visible. I am going to keep working on this and see what I can come up with.
I was thinking something like the vue router example where the routes are based on divs on the page. Maybe using vue-show or vue-if.. arghh , I need to solve this...