mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-22 06:31:45 +08:00
fix(Tabs): skip initial animation
This commit is contained in:
parent
2d2f0d8ad4
commit
49e87756c7
@ -157,14 +157,6 @@ export default createComponent({
|
||||
scrollLeftTo(nav, to, immediate ? 0 : +props.duration);
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
nextTick(() => {
|
||||
state.inited = true;
|
||||
tabHeight = getVisibleHeight(wrapRef.value);
|
||||
scrollIntoView(true);
|
||||
});
|
||||
};
|
||||
|
||||
// update nav bar style
|
||||
const setLine = () => {
|
||||
const shouldAnimate = state.inited;
|
||||
@ -385,11 +377,13 @@ export default createComponent({
|
||||
watch(
|
||||
() => children.length,
|
||||
() => {
|
||||
nextTick(() => {
|
||||
if (state.inited) {
|
||||
setCurrentIndexByName(props.active || currentName.value);
|
||||
setLine();
|
||||
scrollIntoView(true);
|
||||
});
|
||||
nextTick(() => {
|
||||
scrollIntoView(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@ -408,6 +402,15 @@ export default createComponent({
|
||||
}
|
||||
);
|
||||
|
||||
const init = () => {
|
||||
setCurrentIndexByName(props.active || currentName.value);
|
||||
nextTick(() => {
|
||||
state.inited = true;
|
||||
tabHeight = getVisibleHeight(wrapRef.value);
|
||||
scrollIntoView(true);
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(init);
|
||||
|
||||
onActivated(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user