index.ts 417 B

123456789101112131415161718
  1. import { defineStore } from 'pinia'
  2. export const useStore = defineStore('home', {
  3. // 相当于data
  4. state: () => {
  5. return {
  6. // 原始数据
  7. dataAll: {} as any,
  8. mode: {} as any,
  9. currentInfoPart: {} as any,
  10. lastCode: '' as any ,
  11. }
  12. },
  13. // 相当于计算属性
  14. getters: {},
  15. // 相当于vuex的 mutation + action,可以同时写同步和异步的代码
  16. actions: {}
  17. })