我如何使用商店(Vue)的导出默认功能?

How can i use export default function from store( Vue)?

我从另一个人那里得到了一些额外的代码。我不知道如何使用它

我试过使用这个功能,就像 index.js 商店中的任何其他组件一样 在 index.js 我注册了模块:

export const store = new Vuex.Store({
  state: {},
  getters: {},
  mutations: {},
  actions: {

  },
  modules: {
    person,
    applications,
  },
  strict: false
});

let fillTotal = function (s) {
return{...}};
export default function (fatJSON) {
  let obj = fillTotal(fatJSON);
  obj = Object.assign(demoObj, obj);

  axios.post(
    'http://someaddress',
    obj
  ).then(r => console.log(r));
  // console.log('obj', obj);
  // console.log('fatStore', fatStore);
}

我的组件:

template>
  <div>
    <div class="clear_save_button row">
        <button @click="onSave">Сохранить</button>
    </div>
  </div>
</template>
<script>
  import myFunction from '/src/store/index.js'
 methods: {
        executeMyFunction(FatJson){
          myFunction(FatJson);
        },
        onSave() {
          this.executeMyFunction(this.person);
            AXIOS.post(`/profile`, (this.person))
              .then(response => {...

我在组件中有 post 方法,例如:AXIOS.post(/profile, (this.person)) send this.person 如何使用商店中的这个功能?

只需导入该函数并在这样的方法中调用它:

更新:

// src/store/index.js

let fillTotal = function(s) {...}
export const myFunction = (fatJSON) => {
  let obj = fillTotal(fatJSON);
  obj = Object.assign(demoObj, obj);
  axios.post(
    'http://1ss.loc',
    obj
  ).then(r => console.log(r));
}


// in component.vue

import {myFunction} from '@/src/store/index.js';
export default {
  methods: {
    executeMyFunction() {
      myFunction();
    }
  }
}