Created
March 3, 2016 07:17
-
-
Save dewey92/99f1c4429f85fe806e6f to your computer and use it in GitHub Desktop.
Vue router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import VueRouter from 'vue-router' | |
Vue.use(VueRouter) | |
Vue.use(require('vue-resource')) | |
const router = new VueRouter({ | |
history : true, | |
saveScrollPosition: true | |
}); | |
router.map({ | |
'/all' : { | |
component(resolve) { | |
require(['../components/todo-list.vue'], resolve); | |
} | |
}, | |
'/profile' : { | |
component(resolve) { | |
require(['../components/profile.vue'], resolve); | |
} | |
}, | |
'*' : { | |
component(resolve) { | |
require(['../components/not-found.vue'], resolve); | |
} | |
} | |
}); | |
// redirect | |
router.redirect({ | |
'/': '/all', | |
}); | |
const App = Vue.extend({}); | |
router.start(App, '#app'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment