Skip to content

Commit

Permalink
fix(components): [tabs] Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yolo-00 committed May 25, 2024
1 parent 3707e3f commit ee534f3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/components/tabs/src/tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
computed,
defineComponent,
getCurrentInstance,
nextTick,
Expand Down Expand Up @@ -80,6 +81,10 @@ const Tabs = defineComponent({
setup(props, { emit, slots, expose }) {
const ns = useNamespace('tabs')

const isVertical = computed(() =>
['left', 'right'].includes(props.tabPosition)
)

const {
children: panes,
addChild: registerPane,
Expand Down Expand Up @@ -157,8 +162,7 @@ const Tabs = defineComponent({
<div
class={[
ns.e('new-tab'),
['left', 'right'].includes(props.tabPosition) &&
ns.e('new-tab-vertical'),
isVertical.value && ns.e('new-tab-vertical'),
]}
tabindex="0"
onClick={handleTabAdd}
Expand All @@ -180,8 +184,7 @@ const Tabs = defineComponent({
<div
class={[
ns.e('header'),
['left', 'right'].includes(props.tabPosition) &&
ns.e('header-vertical'),
isVertical.value && ns.e('header-vertical'),
ns.is(props.tabPosition),
]}
>
Expand Down

0 comments on commit ee534f3

Please sign in to comment.