Skip to content

Commit

Permalink
fix: 修订变量
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong committed Dec 4, 2024
1 parent bee5920 commit b268d29
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 71 deletions.
6 changes: 3 additions & 3 deletions src/packages/tabs/demos/h5/demo20.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Tabs } from '@nutui/nutui-react'

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

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

const Demo22 = () => {
const [tabvalue, setTabvalue] = useState<string | number>('0')
const [tab1value, setTab1value] = useState<string | number>('0')
const [tabvalue1, setTabvalue1] = useState<string | number>('0')
return (
<>
<Tabs
Expand All @@ -18,9 +18,9 @@ const Demo22 = () => {
<Tabs.TabPane title="Tab 3"> Tab 3 </Tabs.TabPane>
</Tabs>
<Tabs
value={tab1value}
value={tabvalue1}
onChange={(value) => {
setTab1value(value)
setTabvalue1(value)
}}
style={{ '--nutui-tabs-titles-font-size': '12px' }}
>
Expand Down
26 changes: 10 additions & 16 deletions src/packages/tabs/demos/taro/demo13.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,18 @@ const Demo13 = () => {
}}
>
<Tabs.TabPane title="Tab 1">
<View>Tab 1</View>
<View>Tab 1</View>
<View>Tab 1</View>
<View>Tab 1</View>
<View>Tab 1</View>
<View>Tab 1</View>
<View>Tab 1</View>
<View>Tab 1</View>
{Array(8)
.fill(null)
.map((_, index) => (
<View key={index}>Tab 1</View>
))}
</Tabs.TabPane>
<Tabs.TabPane title="Tab 2">
<View>Tab 2</View>
<View>Tab 2</View>
<View>Tab 2</View>
<View>Tab 2</View>
<View>Tab 2</View>
<View>Tab 2</View>
<View>Tab 2</View>
<View>Tab 2</View>
{Array(8)
.fill(null)
.map((_, index) => (
<View key={index}>Tab 2</View>
))}
</Tabs.TabPane>
<Tabs.TabPane title="Tab 3"> Tab 3 </Tabs.TabPane>
</Tabs>
Expand Down
37 changes: 9 additions & 28 deletions src/packages/tabs/demos/taro/demo14.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react-taro'
import { View, Text } from '@tarojs/components'
import { View } from '@tarojs/components'

// TODO:鸿蒙支持的不好
const Demo14 = () => {
const [tab2value, setTab2value] = useState<string | number>('0')
const [tabvalue, setTabvalue] = useState<string | number>('0')
return (
<>
<Tabs
value={tab2value}
value={tabvalue}
autoHeight
onChange={(value) => {
setTab2value(value)
setTabvalue(value)
}}
>
<Tabs.TabPane title="Tab 1">
<View>
<Text>Tab 1</Text>
</View>
<View>
<Text>Tab 1</Text>
</View>
<View>
<Text>Tab 1</Text>
</View>
<View>
<Text>Tab 1</Text>
</View>
<View>
<Text>Tab 1</Text>
</View>
<View>
<Text>Tab 1</Text>
</View>
<View>
<Text>Tab 1</Text>
</View>
<View>
<Text>Tab 1</Text>
</View>
{Array(8)
.fill(null)
.map((_, index) => (
<View key={index}>Tab 1</View>
))}
</Tabs.TabPane>
<Tabs.TabPane title="Tab 2"> Tab 2 </Tabs.TabPane>
<Tabs.TabPane title="Tab 3"> Tab 3 </Tabs.TabPane>
Expand Down
10 changes: 5 additions & 5 deletions src/packages/tabs/demos/taro/demo19.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import { Tabs } from '@nutui/nutui-react-taro'
import { Text } from '@tarojs/components'

const Demo19 = () => {
const [tab6value, setTab6value] = useState<string | number>('0')
const list5 = Array.from(new Array(2).keys())
const [tabvalue, setTabvalue] = useState<string | number>('0')
const list = Array.from(new Array(2).keys())
return (
<>
<Tabs
style={{ height: 300 }}
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}`}>
<Text>Tab {item}</Text>
</Tabs.TabPane>
Expand Down
12 changes: 6 additions & 6 deletions src/packages/tabs/demos/taro/demo20.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import React, { useState } from 'react'
import { Tabs } from '@nutui/nutui-react-taro'

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

const Demo21 = () => {
const [tabvalue, setTabvalue] = useState<string | number>('0')
const [tab2value, setTab2value] = useState<string | number>('0')
const [tabvalue1, setTabvalue1] = useState<string | number>('0')
return (
<>
<Tabs
Expand All @@ -15,9 +15,9 @@ const Demo21 = () => {
>
<Tabs.TabPane title="Tab 1">
<Tabs
value={tab2value}
value={tabvalue1}
onChange={(value) => {
setTab2value(value)
setTabvalue1(value)
}}
direction="vertical"
>
Expand Down
8 changes: 4 additions & 4 deletions src/packages/tabs/demos/taro/demo23.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Tabs } from '@nutui/nutui-react-taro'
import { Star } from '@nutui/icons-react-taro'

const Demo23 = () => {
const [tab7value, setTab7value] = useState('c1')
const [tabvalue, setTabvalue] = useState('c1')
const list = [
{
title: '自定义 1',
Expand All @@ -23,12 +23,12 @@ const Demo23 = () => {
return (
<>
<Tabs
value={tab7value}
value={tabvalue}
title={() => {
return list.map((item) => (
<View
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}
Expand Down

0 comments on commit b268d29

Please sign in to comment.