1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| 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
| }
| }
|
|