-
-
Save NakanoMakoto/d65c753d56fbb68df93789273b3b79ff to your computer and use it in GitHub Desktop.
vue-spaのメモ
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"> | |
<div id="nav"> | |
<router-link to="/">Home</router-link> | | |
<router-link to="/page2">Page2</router-link> | |
</div> | |
<router-view/> | |
</div> | |
</template> | |
<style> | |
#app { | |
font-family: 'Avenir', Helvetica, Arial, sans-serif; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
text-align: center; | |
color: #2c3e50; | |
} | |
#nav { | |
padding: 30px; | |
} | |
#nav a { | |
font-weight: bold; | |
color: #2c3e50; | |
} | |
#nav a.router-link-exact-active { | |
color: #42b983; | |
} | |
</style> |
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, | |
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
<template> | |
<div class="page2"> | |
<h1>This is an page2</h1> | |
</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 Router from 'vue-router'; | |
import Home from './views/Home.vue'; | |
Vue.use(Router); | |
export default new Router({ | |
mode: 'history', | |
base: process.env.BASE_URL, | |
routes: [ | |
{ | |
path: '/', | |
name: 'home', | |
component: Home, | |
}, | |
{ | |
path: '/page2', | |
name: 'page2', | |
component: () => import(/* webpackChunkName: "Page2" */ './views/Page2.vue'), | |
}, | |
], | |
}); |
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'; | |
Vue.use(Router); | |
export default new Router({ | |
mode: 'history', | |
base: process.env.BASE_URL, | |
routes: [ | |
{ | |
path: '/', | |
name: 'home', | |
component: Home, | |
}, | |
{ | |
path: '/about', | |
name: 'about', | |
// route level code-splitting | |
// this generates a separate chunk (about.[hash].js) for this route | |
// which is lazy-loaded when the route is visited. | |
component: () => import(/* webpackChunkName: "about" */ './views/About.vue'), | |
}, | |
], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment