index.js 290 B

1234567891011121314151617
  1. import { defineStore } from 'pinia'
  2. // vuex 写法
  3. const useStore = defineStore({
  4. id: 'admin', // id必填,且需要唯一
  5. state: () => ({
  6. loading: false
  7. }),
  8. getters: {
  9. },
  10. actions: {
  11. setLoading(state) {
  12. this.loading = state
  13. }
  14. }
  15. })
  16. export default useStore