mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
perf(Tabs): avoid repeated initialization
This commit is contained in:
parent
c9417341e0
commit
599e817cd4
@ -1,12 +1,4 @@
|
|||||||
import {
|
import { ref, watch, computed, reactive, nextTick, onActivated } from 'vue';
|
||||||
ref,
|
|
||||||
watch,
|
|
||||||
computed,
|
|
||||||
reactive,
|
|
||||||
nextTick,
|
|
||||||
onMounted,
|
|
||||||
onActivated,
|
|
||||||
} from 'vue';
|
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import {
|
import {
|
||||||
@ -30,6 +22,7 @@ import {
|
|||||||
useWindowSize,
|
useWindowSize,
|
||||||
useScrollParent,
|
useScrollParent,
|
||||||
useEventListener,
|
useEventListener,
|
||||||
|
onMountedOrActivated,
|
||||||
} from '@vant/use';
|
} from '@vant/use';
|
||||||
import { route } from '../composition/use-route';
|
import { route } from '../composition/use-route';
|
||||||
import { useRefs } from '../composition/use-refs';
|
import { useRefs } from '../composition/use-refs';
|
||||||
@ -411,18 +404,13 @@ export default createComponent({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(init);
|
|
||||||
|
|
||||||
onActivated(() => {
|
|
||||||
init();
|
|
||||||
setLine();
|
|
||||||
});
|
|
||||||
|
|
||||||
useExpose({
|
useExpose({
|
||||||
resize: setLine,
|
resize: setLine,
|
||||||
scrollTo,
|
scrollTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onActivated(setLine);
|
||||||
|
onMountedOrActivated(init);
|
||||||
useEventListener('scroll', onScroll, { target: scroller.value });
|
useEventListener('scroll', onScroll, { target: scroller.value });
|
||||||
|
|
||||||
linkChildren({
|
linkChildren({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user