Skip to content

Commit

Permalink
fix: tabs h5
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong committed Dec 3, 2024
1 parent b629e2e commit bee5920
Show file tree
Hide file tree
Showing 22 changed files with 89 additions and 89 deletions.
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo1 = () => {
const [tab1value, setTab1value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
return (
<>
<Tabs
value={tab1value}
value={tabvalue}
onChange={(value) => {
setTab1value(value)
setTabvalue(value)
}}
>
<Tabs.TabPane title="Tab 1"> Tab 1 </Tabs.TabPane>
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo10.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo10 = () => {
const [tab1value, setTab1value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
return (
<>
<Tabs
value={tab1value}
value={tabvalue}
activeType="divider"
align="left"
onChange={(value) => {
setTab1value(value)
setTabvalue(value)
}}
>
<Tabs.TabPane title="Tab 1"> Tab 1</Tabs.TabPane>
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo11.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo11 = () => {
const [tab2value, setTab2value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
return (
<>
<Tabs
value={tab2value}
value={tabvalue}
onChange={(value) => {
setTab2value(value)
setTabvalue(value)
}}
>
<Tabs.TabPane title="Tab 1" value="0">
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo13.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo13 = () => {
const [tab2value, setTab2value] = useState<number | string>('0')
const [tabvalue, setTabvalue] = useState<number | string>('0')
return (
<>
<Tabs
value={tab2value}
value={tabvalue}
style={{ position: 'relative', zIndex: 11 }}
tabStyle={{ position: 'sticky', top: '0px', zIndex: 11 }}
onChange={(value) => {
setTab2value(value)
setTabvalue(value)
}}
>
<Tabs.TabPane title="Tab 1" value="0">
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo14.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo14 = () => {
const [tab2value, setTab2value] = useState<number | string>('0')
const [tabvalue, setTabvalue] = useState<number | string>('0')
return (
<>
<Tabs
value={tab2value}
value={tabvalue}
autoHeight
onChange={(value) => {
setTab2value(value)
setTabvalue(value)
}}
>
<Tabs.TabPane title="Tab 1">
Expand Down
14 changes: 7 additions & 7 deletions src/packages/tabs/demos/h5/demo15.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import React, { useState, useEffect } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo15 = () => {
const [tab3value, setTab3value] = useState<number | string>(0)
const [list3, setList3] = useState<number[]>([])
const [tabvalue, setTabvalue] = useState<number | string>(0)
const [list, setList] = useState<number[]>([])
useEffect(() => {
setTimeout(() => {
setTab3value(2)
setList3([...new Array(3).keys()])
setTabvalue(2)
setList([...new Array(3).keys()])
}, 3000)
}, [])
return (
<>
<Tabs
value={tab3value}
value={tabvalue}
onChange={(value) => {
setTab3value(value)
setTabvalue(value)
}}
>
{list3.map((item) => (
{list.map((item) => (
<Tabs.TabPane key={item} title={`Tab ${item}`}>
Tab {item}
</Tabs.TabPane>
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo16.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo16 = () => {
const [tab4value, setTab4value] = useState<number | string>('0')
const [tabvalue, setTabvalue] = useState<number | string>('0')
return (
<>
<Tabs
value={tab4value}
value={tabvalue}
onChange={(value) => {
setTab4value(value)
setTabvalue(value)
}}
>
<Tabs.TabPane title="低阶特卖">低阶特卖</Tabs.TabPane>
Expand Down
10 changes: 5 additions & 5 deletions src/packages/tabs/demos/h5/demo17.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo17 = () => {
const [tab4value, setTab4value] = useState<number | string>('0')
const list4 = Array.from(new Array(10).keys())
const [tabvalue, setTabvalue] = useState<number | string>('0')
const list = Array.from(new Array(10).keys())
return (
<>
<Tabs
value={tab4value}
value={tabvalue}
style={{ height: '300px' }}
onChange={(value) => {
setTab4value(value)
setTabvalue(value)
}}
direction="vertical"
>
{list4.map((item) => (
{list.map((item) => (
<Tabs.TabPane key={item} title={`Tab ${item}`}>
Tab {item}
</Tabs.TabPane>
Expand Down
10 changes: 5 additions & 5 deletions src/packages/tabs/demos/h5/demo18.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo18 = () => {
const [tab5value, setTab5value] = useState<number | string>('0')
const list5 = Array.from(new Array(2).keys())
const [tabvalue, setTabvalue] = useState<number | string>('0')
const list = Array.from(new Array(2).keys())
return (
<>
<Tabs
style={{ height: '300px' }}
value={tab5value}
value={tabvalue}
onChange={(value) => {
setTab5value(value)
setTabvalue(value)
}}
direction="vertical"
>
{list5.map((item) => (
{list.map((item) => (
<Tabs.TabPane key={item} title={`Tab ${item}`}>
Tab {item}
</Tabs.TabPane>
Expand Down
10 changes: 5 additions & 5 deletions src/packages/tabs/demos/h5/demo19.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo19 = () => {
const [tab6value, setTab6value] = useState<number | string>('0')
const list5 = Array.from(new Array(2).keys())
const [tabvalue, setTabvalue] = useState<number | string>('0')
const list = Array.from(new Array(2).keys())
return (
<>
<Tabs
style={{ height: '300px' }}
value={tab6value}
value={tabvalue}
onChange={(value) => {
setTab6value(value)
setTabvalue(value)
}}
activeType="smile"
direction="vertical"
>
{list5.map((item) => (
{list.map((item) => (
<Tabs.TabPane key={item} title={`Tab ${item}`}>
Tab {item}
</Tabs.TabPane>
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo2 = () => {
const [tab1value, setTab1value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
return (
<>
<Tabs
value={tab1value}
value={tabvalue}
onChange={(value) => {
setTab1value(value)
setTabvalue(value)
}}
activeType="smile"
>
Expand Down
12 changes: 6 additions & 6 deletions src/packages/tabs/demos/h5/demo20.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo20 = () => {
const [tab8value, setTab8value] = useState<number | string>('0')
const [tab9value, setTab9value] = useState<number | string>('0')
const [tabvalue, setTabvalue] = useState<number | string>('0')
const [tab1value, setTab1value] = useState<number | string>('0')
return (
<>
<Tabs
value={tab8value}
value={tabvalue}
onChange={(value) => {
setTab8value(value)
setTabvalue(value)
}}
direction="vertical"
>
<Tabs.TabPane title="Tab 1">
<Tabs
value={tab9value}
value={tab1value}
onChange={(value) => {
setTab9value(value)
setTab1value(value)
}}
direction="horizontal"
>
Expand Down
12 changes: 6 additions & 6 deletions src/packages/tabs/demos/h5/demo21.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo21 = () => {
const [tab8value, setTab8value] = useState<number | string>('0')
const [tab9value, setTab9value] = useState<number | string>('0')
const [tabvalue, setTabvalue] = useState<number | string>('0')
const [tab1value, setTab1value] = useState<number | string>('0')
return (
<>
<Tabs
value={tab8value}
value={tabvalue}
onChange={(value) => {
setTab8value(value)
setTabvalue(value)
}}
autoHeight
>
<Tabs.TabPane title="Tab 1">
<Tabs
value={tab9value}
value={tab1value}
onChange={(value) => {
setTab9value(value)
setTab1value(value)
}}
direction="vertical"
>
Expand Down
12 changes: 6 additions & 6 deletions src/packages/tabs/demos/h5/demo22.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo22 = () => {
const [tab11value, setTab11value] = useState<string | number>('0')
const [tab12value, setTab12value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
const [tab1value, setTab1value] = useState<string | number>('0')
return (
<>
<Tabs
value={tab11value}
value={tabvalue}
onChange={(value) => {
setTab11value(value)
setTabvalue(value)
}}
style={{ '--nutui-tabs-titles-font-size': '20px' }}
>
Expand All @@ -18,9 +18,9 @@ const Demo22 = () => {
<Tabs.TabPane title="Tab 3"> Tab 3 </Tabs.TabPane>
</Tabs>
<Tabs
value={tab12value}
value={tab1value}
onChange={(value) => {
setTab12value(value)
setTab1value(value)
}}
style={{ '--nutui-tabs-titles-font-size': '12px' }}
>
Expand Down
14 changes: 7 additions & 7 deletions src/packages/tabs/demos/h5/demo23.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Tabs } from '@nutui/nutui-react'
import { Star } from '@nutui/icons-react'

const Demo23 = () => {
const [tab7value, setTab7value] = useState('c1')
const list6 = [
const [tabvalue, setTabvalue] = useState('c1')
const list = [
{
title: '自定义 1',
paneKey: 'c1',
Expand All @@ -22,12 +22,12 @@ const Demo23 = () => {
return (
<>
<Tabs
value={tab7value}
value={tabvalue}
title={() => {
return list6.map((item) => (
return list.map((item) => (
<div
onClick={() => setTab7value(item.paneKey)}
className={`nut-tabs-titles-item ${tab7value === item.paneKey ? 'nut-tabs-titles-item-active' : ''}`}
onClick={() => setTabvalue(item.paneKey)}
className={`nut-tabs-titles-item ${tabvalue === item.paneKey ? 'nut-tabs-titles-item-active' : ''}`}
key={item.paneKey}
>
{item.icon || null}
Expand All @@ -37,7 +37,7 @@ const Demo23 = () => {
))
}}
>
{list6.map((item) => (
{list.map((item) => (
<Tabs.TabPane key={item.paneKey} value={item.paneKey}>
{item.title}
</Tabs.TabPane>
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo3 = () => {
const [tab1value, setTab1value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
return (
<>
<Tabs
value={tab1value}
value={tabvalue}
onChange={(value) => {
setTab1value(value)
setTabvalue(value)
}}
activeType="simple"
>
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react'

const Demo4 = () => {
const [tab1value, setTab1value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
return (
<>
<Tabs
value={tab1value}
value={tabvalue}
onChange={(value) => {
setTab1value(value)
setTabvalue(value)
}}
activeType="card"
>
Expand Down
Loading

0 comments on commit bee5920

Please sign in to comment.