iris/_examples/file-server/single-page-application/basic/public/index.js
Gerasimos (Makis) Maropoulos 7b6a8f1e26
simplify some examples
2020-11-07 12:49:14 +02:00

22 lines
443 B
JavaScript

const NotFound = { template: '<p>Page not found</p>' }
const Home = { template: '<p>home page</p>' }
const About = { template: '<p>about page</p>' }
const routes = {
'/': Home,
'/about': About
}
const app = new Vue({
el: '#app',
data: {
currentRoute: window.location.pathname
},
computed: {
ViewComponent () {
return routes[this.currentRoute] || NotFound
}
},
render (h) { return h(this.ViewComponent) }
})