Last active
July 30, 2018 14:46
-
-
Save nguyenvanduocit/111c75c4d461bc07f29446c76de2c738 to your computer and use it in GitHub Desktop.
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
<template> | |
<div id="app" :class="[$style.app]"> | |
<div :class="$style.header"> | |
<nav :class="$style.nav"> | |
<router-link to="/">Home</router-link> | | |
<router-link to="/about">About</router-link> | |
</nav> | |
</div> | |
<main :class="$style.main"> | |
<router-view/> | |
</main> | |
<footer :class="$style.footer"> | |
</footer> | |
</div> | |
</template> |
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 App from './App.vue' | |
import router from './router' | |
Vue.config.productionTip = false | |
new Vue({ | |
router, | |
store, | |
render: h => h(App) | |
}).$mount('#app') |
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 Router from 'vue-router' | |
import Home from './views/Home.vue' | |
import GetLink from './views/GetLink.vue' | |
import About from './views/About.vue' | |
Vue.use(Router) | |
export default new Router({ | |
routes: [ | |
{ | |
path: '/', | |
name: 'home', | |
component: Home | |
}, | |
{ | |
path: '/getlink/:postId', | |
name: 'getLink', | |
component: GetLink, | |
props: true | |
}, | |
{ | |
path: '/about', | |
name: 'about', | |
component: About | |
} | |
], | |
scrollBehavior (to, from, savedPosition) { | |
if (savedPosition) { | |
return savedPosition | |
} else { | |
return { x: 0, y: 0 } | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment