Last active
November 16, 2016 13:32
-
-
Save renegoretzka/0f4ab47a0e0f53b8f38fea089726c158 to your computer and use it in GitHub Desktop.
main.js
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
// main.js | |
import Vue from 'vue' | |
import store from './store' | |
import router from './router' | |
import App from './App' | |
/* eslint-disable no-new */ | |
new Vue({ | |
el: '#app', | |
template: '<App/>', | |
components: { App } | |
}) | |
// App.vue | |
<template> | |
<div id="app"> | |
<router-view></router-view> | |
</div> | |
</template> | |
<script> | |
import Hello from './components/Hello' | |
export default { | |
name: 'app', | |
components: { | |
Hello | |
} | |
} | |
</script> | |
// Hello.vue | |
<template> | |
<div class="hello"> | |
<h1>{{ msg }}</h1> | |
<h2>Essential Links</h2> | |
<ul> | |
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li> | |
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li> | |
<li><a href="https://gitter.im/vuejs/vue" target="_blank">Gitter Chat</a></li> | |
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li> | |
<br> | |
<li><a href="http://vuejs-templates.github.io/webpack/" target="_blank">Docs for This Template</a></li> | |
</ul> | |
<h2>Ecosystem</h2> | |
<ul> | |
<li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li> | |
<li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li> | |
<li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li> | |
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li> | |
</ul> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'hello', | |
data () { | |
return { | |
msg: 'Welcome to Your Vue.js App' | |
} | |
} | |
} | |
</script> | |
// router/index.js | |
import Vue from 'vue' | |
import Router from 'vue-router' | |
Vue.use(Router) | |
import Hello from '../components/Hello.vue' | |
export default new Router({ | |
mode: 'history', | |
scrollBehavior: () => ({ y: 0 }), | |
routes: [ | |
{ path: '*', component: Hello } | |
] | |
}) | |
// store/index.js | |
import Vue from 'vue' | |
import Vuex from 'vuex' | |
Vue.use(Vuex) | |
const store = new Vuex.Store({ | |
state: {}, | |
actions: {}, | |
mutations: {}, | |
getters: {} | |
}) | |
export default store |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment