Skip to content

Commit

Permalink
feat(Tabs): supports sliding to tabs beyond the maximum width when co…
Browse files Browse the repository at this point in the history
…mponent mounted
  • Loading branch information
Zz-ZzzZ committed Nov 21, 2023
1 parent 0fae504 commit 4f12e07
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tabs/tab-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ export default defineComponent({
const removeBtnClick = ({ e, value, index }: Parameters<TdTabsProps['onRemove']>[0]) => {
props.onRemove({ e, value, index });
};
const setActiveTab = (ref: any) => {
if (ref?.value === props.value && activeTabRef.value !== ref.$el) {
const setActiveTab = (ref: any, force = false) => {
if ((ref?.value === props.value && activeTabRef.value !== ref.$el) || force) {
activeTabRef.value = ref.$el;
scrollLeft.value = moveActiveTabIntoView(
{
Expand All @@ -193,6 +193,7 @@ export default defineComponent({
const { setNavsWrap } = useDragSort(props);
onMounted(() => {
setNavsWrap(navsWrapRef.value);
setActiveTab(activeTabRef.value, true);
});
// renders
const navs = computed(() => {
Expand Down

0 comments on commit 4f12e07

Please sign in to comment.