Skip to content

Commit

Permalink
Move Router to router.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Aug 12, 2018
1 parent 5327323 commit d28aafe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 32 deletions.
18 changes: 1 addition & 17 deletions MyApp/src/main.ts
Expand Up @@ -6,26 +6,10 @@ import 'es6-shim';

import Vue from 'vue';
import './plugins/vuetify';
import Router from 'vue-router';
import App from './App.vue';
import Home from './home/Home.vue';
import View1 from './view1/View1.vue';
import View2 from './view2/View2.vue';

const routes = [
{ path: '/', component: Home, props: { name: 'Vue' } },
{ path: '/view1', component: View1 },
{ path: '/view2', component: View2 },
{ path: '*', redirect: '/' },
];
import router from './router';

const router = new Router ({
mode: 'history',
linkActiveClass: 'active',
routes,
});

Vue.use(Router);
const app = new Vue({
el: '#app',
render: (h) => h(App),
Expand Down
30 changes: 15 additions & 15 deletions MyApp/src/router.ts
@@ -1,21 +1,21 @@
import Vue from 'vue';
import Router from 'vue-router';
import Home from './views/Home.vue';
import About from './views/About.vue';

import Home from './home/Home.vue';
import View1 from './view1/View1.vue';
import View2 from './view2/View2.vue';

Vue.use(Router);

export default new Router({
routes: [
{
path: '/',
name: 'home',
component: Home,
},
{
path: '/about',
name: 'about',
component: About,
},
],
const routes = [
{ path: '/', component: Home, props: { name: 'Vue' } },
{ path: '/view1', component: View1 },
{ path: '/view2', component: View2 },
{ path: '*', redirect: '/' },
];

export default new Router ({
mode: 'history',
linkActiveClass: 'active',
routes,
});

0 comments on commit d28aafe

Please sign in to comment.