33 lines
548 B
JavaScript
33 lines
548 B
JavaScript
import {
|
|
computed,
|
|
reactive,
|
|
nextTick,
|
|
ref
|
|
} from 'vue';
|
|
|
|
|
|
export default function useIndexList() {
|
|
const tabAct = ref(0);
|
|
const listItemRefs = ref([]);
|
|
const tabChange = (item) => {
|
|
tabAct.value = item.index;
|
|
};
|
|
|
|
const swiperChange = (item) => {
|
|
tabAct.value = item.detail.current;
|
|
};
|
|
|
|
const search = (value) => {
|
|
console.log('search', value);
|
|
listItemRefs.value.forEach((item, index) => {
|
|
item?.search(value, tabAct.value === index);
|
|
});
|
|
};
|
|
return {
|
|
tabAct,
|
|
listItemRefs,
|
|
tabChange,
|
|
swiperChange,
|
|
search,
|
|
};
|
|
} |