zoukankan      html  css  js  c++  java
  • vuex配置

    import Vue from 'vue'
    import App from './App.vue'
    import router from './router'
    import store from './store'
    import Vuex from 'vuex'
    
     Vue.use(Vuex)
     const myStore = new Vuex.Store({
        state :{
          count:0
        },
        getters:{
           getCount(state){
                return '当前最新的count值是:'+state.count
           }
        },
        mutations:{
           add(state){
              state.count++
           }
        },
        actions:{
            mody(e){
                setTimeout( ()=>{
                  e.commit('add')
                },2000 )
            }
        }
        
    })
    
    Vue.config.productionTip = false
    
    new Vue({
      router,
      store:myStore,
      render: h => h(App)
    }).$mount('#app')
  • 相关阅读:
    Git的使用
    Flask(五)
    Flask(四)
    Flask(二)
    Flask(一)
    SDL 五子棋游戏
    c++单例模式
    ubuntu安装虚拟机
    git 命令
    汇编x86入门
  • 原文地址:https://www.cnblogs.com/javascript9527/p/11504270.html
Copyright © 2011-2022 走看看