import {ref} from "vue"; import {searchCarListByNameApi} from "@/views/moudle/carInfo/apis"; export default function useBoxListSearch() { const loading = ref(false); const selectBox = ref(''); let boxList = ref([]); async function boxListSearch(carName) { loading.value = true; try { let res = await searchCarListByNameApi(carName); let rs =res.data; let list = []; if(rs.code === 1) { list = rs.data; } boxList.value = list.map(item=>{ return { label: item.boxName, value: item.boxName } }); loading.value = false; }catch (e) { boxList.value = []; loading.value = false; } } return { loading, selectBox, boxList, boxListSearch } }