参考

 

import { mapState, mapMutations } from "vuex";
computed: {
    ...mapState({
      theme: (state) => state.settings.theme,
      sideTheme: (state) => state.settings.sideTheme,
      sidebar: (state) => state.app.sidebar,
      showHide: (state) => state.app.showHide,
      classIndex: (state) => state.app.classIndex,
      device: (state) => state.app.device,
      needTagsView: (state) => state.settings.tagsView,
      fixedHeader: (state) => state.settings.fixedHeader,
    }),
 
经过测试下面2中方式都可以
 
  methods: {
    ...mapMutations({
      SET_SHOW: "app/SET_SHOW",
      CHANGE_TAGSVIEW: "settings/CHANGE_TAGSVIEW",
    }),
    // ...mapMutations( "app", ["SET_SHOW"]),
    // ...mapMutations( "settings", ["CHANGE_TAGSVIEW"]),
 
 
 
 

https://blog.csdn.net/qq_33706382/article/details/103614589?ops_request_misc=&request_id=&biz_id=102&utm_term=vuex%E5%88%86%E6%A8%A1%E5%9D%97%E5%90%8E%E6%80%8E%E4%B9%88%E8%8E%B7%E5%8F%96%E5%A4%9A%E4%B8%AAmapMutations&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-1-103614589.first_rank_v2_pc_rank_v29&spm=1018.2226.3001.4187

 

https://blog.csdn.net/weixin_39015132/article/details/84143962?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164015375516780271552425%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=164015375516780271552425&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-14-84143962.first_rank_v2_pc_rank_v29&utm_term=vuex%E5%88%86%E6%A8%A1%E5%9D%97%E5%90%8E%E6%80%8E%E4%B9%88%E8%8E%B7%E5%8F%96%E5%A4%9A%E4%B8%AAmapMutations&spm=1018.2226.3001.4187

 

posted on 2021-12-22 14:51  努力才会进步  阅读(928)  评论(0编辑  收藏  举报