Skip to content

Instantly share code, notes, and snippets.

@ktquez
Forked from dewey92/home.js
Created May 27, 2016 02:16
Show Gist options
  • Save ktquez/52b3b72b7f27ad368c64b939623fc1bf to your computer and use it in GitHub Desktop.
Save ktquez/52b3b72b7f27ad368c64b939623fc1bf to your computer and use it in GitHub Desktop.
Vue router
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