import { queryBannerList } from '@/api/ad';
import { ref } from 'vue';

const banners = ref();
// 初始化 data 数据, 如果不存在 banner 数据，那么重新获取
!banners.value&& initBannerData();

async function initBannerData() {
  const { data } = await queryBannerList();
  banners.value = data.data.banner_list;
  // console.log(`banner data`,banners.value);
}

export function updateBanners(defineBanners:unknown){
  banners.value = defineBanners
}

export { initBannerData, banners };