added routing example

This commit is contained in:
Geoff Doty 2019-06-19 17:45:10 -04:00
parent 7ea3b9aee9
commit fd8d03fc11
5 changed files with 52 additions and 44 deletions

View File

@ -3,3 +3,5 @@ body {font-size: 1.2em;}
.header, .footer { .header, .footer {
margin: 1.4em 0; margin: 1.4em 0;
} }
code {color: indianred}

View File

@ -43,6 +43,11 @@ route('/', function () {
riot.mount('#view', 'home'); riot.mount('#view', 'home');
}); });
// about page
route('/about', function () {
riot.mount('#view', 'about');
});
// [ start router ] ------------------------------ // [ start router ] ------------------------------
route.start(true); route.start(true);

View File

@ -1,11 +1,11 @@
<Home> <Home>
<section class="is-clear"> <section class="">
<h1>RiotJS Kickstarter</h1> <h1>RiotJS Kickstarter</h1>
Built your next revolutionary <em>Single Page Application</em> (SPA) starting right here: Built your next revolutionary <em>Single Page Application</em> (SPA) starting right here:
<blockquote>/app/tags/home.tag.html</blockquote> <blockquote><code>/app/tags/home.tag.html</code> </blockquote>
This <strong>seed</strong> kicks your development into high gear with all tools you'll <em>need</em>, and very <em>little</em> you don't. This <strong>seed</strong> kicks your development into high gear with all tools you'll <em>need</em>, and very <em>little</em> you don't.

View File

@ -1,6 +1,6 @@
<Footer> <Footer>
<section class="footer"> <section class="footer">
&copy;2018 Your Website | &copy;2019 Your Website |
All rights reserved. | All rights reserved. |
<a href="http://riotjs.com">RiotJS</a> &nbsp; <a href="http://riotjs.com">RiotJS</a> &nbsp;
<a href="http://n2geoff.github.io/grayscale/">Grayscale CSS</a> <a href="http://n2geoff.github.io/grayscale/">Grayscale CSS</a>

View File

@ -1,13 +1,14 @@
<Header> <Header>
<section class="header"> <section class="nav">
<ul class="navbar"> <div class="nav-section">
<li class="nav is-large">RiotJS</li> <div class="is-large">RiotJS</div>
<li class="nav"><a href="#/">Home</a></li> <div class="content"><a href="#/">Home</a></div>
</ul> <div class=""><a href="#/about">About</a></div>
</div>
</section> </section>
<style> <style>
/* scoped styles */ /* scoped styles */
.header {border-bottom: 1px solid #222;} .nav {border-bottom: 1px solid #222;}
</style> </style>
</Header> </Header>