/*
 * @Author: Gui
 * @Date: 2023-04-07 16:09:33
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-06-01 17:57:43
 * @Description: kxs files
 * @filePath:
 */
import { BrandList } from "@/api/brandlist";
import { onMounted, ref } from "vue";
type Data = {
  status?: string;
  info?: string;
  other?: any;
  data?: Array<objectData>;
};
type objectData = {
  Name?: string;
  Id?: Number;
};

export function BrandListHook() {
  const Brand: any = ref([]);
  function getBrandList() {
    // 开始加载
    BrandList({}).then((data?: Data) => {
      Brand.value = data.data.map(data => {
        return { Name: data.Name, Id: data.Id };
      });
    });
  }
  onMounted(() => {
    getBrandList();
  });
  return {
    Brand
  };
}
