首页 > 其他 > 详细

Vuex推荐的目录结构

时间:2020-07-06 18:02:54      阅读:44      评论:0      收藏:0      [点我收藏+]

技术分享图片

src\store\index.js

import Vue from "vue";
import Vuex from ‘vuex‘
import mutations from "./mutations";
import actions from "./actions";
import getters from "./getters";
import moduleA from "./modules/moduleA"
//1 安装插件
Vue.use(Vuex)

const state = {
  counter:999,
  info:{
    name:‘kobe‘,
    age:40,
    height:198
  }
}
//Vuex有一个Store类
const store = new Vuex.Store({
  //保存状态
  state,
  mutations,
  actions,
  getters,
  modules:{
    a:moduleA
  }
})
//3 导出store对象
export default store

完整代码

链接:https://pan.baidu.com/s/13UX5PMTcLtt-Nq5s-Dp-CQ
提取码:3c6p

Vuex推荐的目录结构

原文:https://www.cnblogs.com/polax/p/13256080.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!