mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-22 14:39:16 +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);
|
scrollLeftTo(nav, to, immediate ? 0 : +props.duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
const init = () => {
|
|
||||||
nextTick(() => {
|
|
||||||
state.inited = true;
|
|
||||||
tabHeight = getVisibleHeight(wrapRef.value);
|
|
||||||
scrollIntoView(true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// update nav bar style
|
// update nav bar style
|
||||||
const setLine = () => {
|
const setLine = () => {
|
||||||
const shouldAnimate = state.inited;
|
const shouldAnimate = state.inited;
|
||||||
@ -385,12 +377,14 @@ export default createComponent({
|
|||||||
watch(
|
watch(
|
||||||
() => children.length,
|
() => children.length,
|
||||||
() => {
|
() => {
|
||||||
nextTick(() => {
|
if (state.inited) {
|
||||||
setCurrentIndexByName(props.active || currentName.value);
|
setCurrentIndexByName(props.active || currentName.value);
|
||||||
setLine();
|
setLine();
|
||||||
|
nextTick(() => {
|
||||||
scrollIntoView(true);
|
scrollIntoView(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@ -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);
|
onMounted(init);
|
||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user