Compare commits

..

No commits in common. "ccd92a6eeecdcae5c16e21968f9484e92cc5a0df" and "282021de4e0d017fcae894ddf7e69ba1c67dfe2b" have entirely different histories.

3 changed files with 21 additions and 24 deletions

View File

@ -346,7 +346,7 @@ exports[`should have two "van-coupon-list__empty" classes when render coupon lis
</span>
</div>
<div class="van-tabs__line"
style="transform: translateX(50px) translateX(-50%); transition-duration: 0.3s;"
style="transform: translateX(50px) translateX(-50%);"
>
</div>
</div>

View File

@ -9,7 +9,7 @@ PickerGroup 中可以放置以下组件:
- [Picker](#/zh-CN/picker)
- [Area](#/zh-CN/area)
- [DatePicker](#/zh-CN/date-picker)
- [TimePicker](#/zh-CN/time-picker)
- [TimePicker](<(#/zh-CN/time-picker)>)
- 其他基于 Picker 封装的自定义组件
### 引入

View File

@ -216,10 +216,7 @@ export default defineComponent({
}
};
const setCurrentIndex = (
currentIndex: number,
skipScrollIntoView?: boolean
) => {
const setCurrentIndex = (currentIndex: number) => {
const newIndex = findAvailableTab(currentIndex);
if (!isDef(newIndex)) {
@ -239,31 +236,16 @@ export default defineComponent({
emit('change', newName, newTab.title);
}
}
if (!skipScrollIntoView) {
scrollIntoView();
}
setLine();
// scroll to correct position
if (stickyFixed && !props.scrollspy) {
setRootScrollTop(
Math.ceil(getElementTop(root.value!) - offsetTopPx.value)
);
}
};
// correct the index of active tab
const setCurrentIndexByName = (
name: Numeric,
skipScrollIntoView?: boolean
) => {
const setCurrentIndexByName = (name: Numeric) => {
const matched = children.find(
(tab, index) => getTabName(tab, index) === name
);
const index = matched ? children.indexOf(matched) : 0;
setCurrentIndex(index, skipScrollIntoView);
setCurrentIndex(index);
};
const scrollToCurrentContent = (immediate = false) => {
@ -436,8 +418,23 @@ export default defineComponent({
}
);
watch(
() => state.currentIndex,
() => {
scrollIntoView();
setLine();
// scroll to correct position
if (stickyFixed && !props.scrollspy) {
setRootScrollTop(
Math.ceil(getElementTop(root.value!) - offsetTopPx.value)
);
}
}
);
const init = () => {
setCurrentIndexByName(props.active, true);
setCurrentIndexByName(props.active);
nextTick(() => {
state.inited = true;
if (wrapRef.value) {