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 {
|
||||
ref,
|
||||
watch,
|
||||
computed,
|
||||
reactive,
|
||||
nextTick,
|
||||
onMounted,
|
||||
onActivated,
|
||||
} from 'vue';
|
||||
import { ref, watch, computed, reactive, nextTick, onActivated } from 'vue';
|
||||
|
||||
// Utils
|
||||
import {
|
||||
@ -30,6 +22,7 @@ import {
|
||||
useWindowSize,
|
||||
useScrollParent,
|
||||
useEventListener,
|
||||
onMountedOrActivated,
|
||||
} from '@vant/use';
|
||||
import { route } from '../composition/use-route';
|
||||
import { useRefs } from '../composition/use-refs';
|
||||
@ -411,18 +404,13 @@ export default createComponent({
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(init);
|
||||
|
||||
onActivated(() => {
|
||||
init();
|
||||
setLine();
|
||||
});
|
||||
|
||||
useExpose({
|
||||
resize: setLine,
|
||||
scrollTo,
|
||||
});
|
||||
|
||||
onActivated(setLine);
|
||||
onMountedOrActivated(init);
|
||||
useEventListener('scroll', onScroll, { target: scroller.value });
|
||||
|
||||
linkChildren({
|
||||
|
Loading…
x
Reference in New Issue
Block a user