import {
    defineStore
} from 'pinia'
import {
    GetCarouseApi
} from '@/service/api.js'

//新闻与展会状态管理

const useCarouse = defineStore("useCarouse", {
    state: () => ({
        CarouseList: [{
            "_id": "",
            "path": "",
            "sort": "0",
            "children": [{
                "title": "",
                "sub_title": "",
                "image": ""
            }]
        }]
    }),
    getters: {

    },
    actions: {
        async GetCarouseFunctin() {
            try {
                const res = await GetCarouseApi();
                this.CarouseList = res.rows;
            } catch (error) {
                console.error('获取轮播图失败:', error);
            }
        }
    }
})

export default useCarouse