• This project
    • Loading...
  • Sign in

Hooke / demo-vue-vuex

Itomix
Go to a project
Toggle navigation Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • Snippets
  • Network
  • Create a new issue
  • Builds
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Network
  • Compare
  • Branches
  • Tags
Switch branch/tag
  • demo-vue-vuex
  • src
  • main.js
  • Hooke's avatar
    vuex 中全局共享登录状态 · 71da455f
    71da455f
    Hooke authored 2016-10-29 22:00:22 +0800
main.js 444 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
import Vue from 'vue'
import Vuex from 'vuex'
import App from './App.vue'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        count: 0,
        size: 10,
        isLogin: false
    },
    mutations: {
        increment: state => state.count++,
        decrement: state => state.count--,
        login: state => state.isLogin = true
    }
})

new Vue({
    el: '#app',
    store,
    render: h => h(App)
})

export {
    store
}