重构学习任务
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user