index.js 841 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * @Author: 廖明明
  3. * @Date: 2022-03-31 16:36:19
  4. * @LastEditors: 廖明明
  5. * @LastEditTime: 2022-04-01 17:45:03
  6. * @Description:vuex入口文件
  7. */
  8. import Vue from "vue";
  9. import Vuex from "vuex";
  10. import user from "@/store/modules/user";
  11. Vue.use(Vuex);
  12. const myPlugin = (store) => {
  13. // 当 store 初始化后调用
  14. let vuexStorage = uni.getStorageSync("vuexStorage");
  15. if (vuexStorage) {
  16. console.log(vuexStorage)
  17. store.replaceState(vuexStorage);
  18. }
  19. store.subscribe((mutation, state) => {
  20. uni.setStorageSync("vuexStorage", state);
  21. });
  22. };
  23. export default new Vuex.Store({
  24. state: {
  25. isShowSeiminModel: false
  26. },
  27. mutations: {
  28. //是否显示切换科室弹窗
  29. changeSeiminModel(state, args) {
  30. state.isShowSeiminModel = args;
  31. }
  32. },
  33. modules: {
  34. user,
  35. },
  36. plugins: [myPlugin],
  37. });