mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 19:07:06 +00:00
simplify some examples
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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) }
|
||||
})
|
||||
Reference in New Issue
Block a user