Last active
March 4, 2018 13:49
-
-
Save mdunbavan/de52e156ddffa8e1fc59b8cca2598651 to your computer and use it in GitHub Desktop.
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 axios from 'axios' | |
import VueAxios from 'vue-axios' | |
import VueRouter from 'vue-router' | |
import Vuex from 'vuex' | |
import { mapGetters } from 'vuex' | |
import VueCookie from 'vue-cookie' | |
import Scrapbook from './components/Scrapbook' | |
import routes from './routes' | |
Vue.use(VueRouter) | |
Vue.use(VueCookie) | |
Vue.use(VueAxios, axios) | |
Vue.use(Vuex) | |
const router = new VueRouter({ | |
mode: 'history', | |
routes | |
}) | |
const store = new Vuex.Store({ | |
state: { | |
products: [] | |
}, | |
getters:{ | |
productsAll: state => { | |
return state.products; | |
} | |
}, | |
mutations: { | |
addProducts (state, product) { | |
state.products = product | |
} | |
} | |
}) | |
var date = new Date(); | |
var res = ''; | |
new Vue({ | |
el: '#app', | |
render: res.render, | |
staticRenderFns: res.staticRenderFns, | |
components: { | |
Scrapbook: Scrapbook | |
}, | |
data () { | |
return { | |
} | |
}, | |
router, | |
methods: { | |
}, | |
mounted: function () { | |
} | |
}) |
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
const routes = [ | |
{path: '/scrapbook.php', component: Scrapbook, props: true, meta: {title: 'Scrapbook'}}, | |
]; |
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> | |
<main-nav/></main-nav> | |
</template> | |
<script> | |
import MainNav from './MainNav' | |
export default { | |
components: { | |
Scrapbook | |
}, | |
name: 'scrapbook', | |
data () { | |
return { | |
welcomeMessage: 'Story Navigation' | |
} | |
}, | |
computed: { | |
products() { | |
return this.$store.state.products; | |
}, | |
}, | |
methods: { | |
}, | |
} | |
</script> | |
<style lang="scss" scoped> | |
.nav-bar{ | |
background-color: #f7f7f7; | |
width: 250px; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment