import { defineStore } from 'pinia'

export const useMainStore = defineStore('mainStore', {
    state: () => ({
        count: 0
    }),
    getters: {
        doubleCount() {
            return this.count * 2;
        },
        tripleCount() {
            return this.count * 3;
        }
    },
    actions: {
        // async incrementAsync() {
        //     // 模擬非同步操作
        //     await new Promise(resolve => setTimeout(resolve, 1000));
        //     this.count++;
        // }
        getImageUrl(name) {
            console.log('name',name);
            return new URL(`/src/assets/img/${name}`, import.meta.url).href;
        },
    },
})