
import { defineStore } from 'pinia';
export const useStore = defineStore(
    'main',
    () => {
      const someState = ref('你好 pinia')
      return { someState }
    },
    {
      persist: {
        // 调整为兼容多端的API
        storage: {
          setItem(key, value) {
            uni.setStorageSync(key, value) 
          },
          getItem(key) {
            return uni.getStorageSync(key) 
          },
        },
      },

    },
)
 
export const useCounterStore = defineStore('counter', {
	state: () => {
		return { count: 0 };
	},
	// 也可以这样定义
	// state: () => ({ count: 0 })
	actions: {
		increment() {
			this.count++;
		},
	},
});