From b268d29ac8801590be0b7b03c566b5bef3431d5c Mon Sep 17 00:00:00 2001 From: hanyuxinting Date: Wed, 4 Dec 2024 16:50:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E8=AE=A2=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/tabs/demos/h5/demo20.tsx | 6 ++-- src/packages/tabs/demos/h5/demo21.tsx | 6 ++-- src/packages/tabs/demos/h5/demo22.tsx | 6 ++-- src/packages/tabs/demos/taro/demo13.tsx | 26 +++++++---------- src/packages/tabs/demos/taro/demo14.tsx | 37 ++++++------------------- src/packages/tabs/demos/taro/demo19.tsx | 10 +++---- src/packages/tabs/demos/taro/demo20.tsx | 12 ++++---- src/packages/tabs/demos/taro/demo21.tsx | 6 ++-- src/packages/tabs/demos/taro/demo23.tsx | 8 +++--- 9 files changed, 46 insertions(+), 71 deletions(-) diff --git a/src/packages/tabs/demos/h5/demo20.tsx b/src/packages/tabs/demos/h5/demo20.tsx index 45228a6e6b..d8a7199037 100644 --- a/src/packages/tabs/demos/h5/demo20.tsx +++ b/src/packages/tabs/demos/h5/demo20.tsx @@ -3,7 +3,7 @@ import { Tabs } from '@nutui/nutui-react' const Demo20 = () => { const [tabvalue, setTabvalue] = useState('0') - const [tab1value, setTab1value] = useState('0') + const [tabvalue1, setTabvalue1] = useState('0') return ( <> { > { - setTab1value(value) + setTabvalue1(value) }} direction="horizontal" > diff --git a/src/packages/tabs/demos/h5/demo21.tsx b/src/packages/tabs/demos/h5/demo21.tsx index 75a85590f6..fb4ce582bf 100644 --- a/src/packages/tabs/demos/h5/demo21.tsx +++ b/src/packages/tabs/demos/h5/demo21.tsx @@ -3,7 +3,7 @@ import { Tabs } from '@nutui/nutui-react' const Demo21 = () => { const [tabvalue, setTabvalue] = useState('0') - const [tab1value, setTab1value] = useState('0') + const [tabvalue1, setTabvalue1] = useState('0') return ( <> { > { - setTab1value(value) + setTabvalue1(value) }} direction="vertical" > diff --git a/src/packages/tabs/demos/h5/demo22.tsx b/src/packages/tabs/demos/h5/demo22.tsx index 777ee8b9b7..597a8b711a 100644 --- a/src/packages/tabs/demos/h5/demo22.tsx +++ b/src/packages/tabs/demos/h5/demo22.tsx @@ -3,7 +3,7 @@ import { Tabs } from '@nutui/nutui-react' const Demo22 = () => { const [tabvalue, setTabvalue] = useState('0') - const [tab1value, setTab1value] = useState('0') + const [tabvalue1, setTabvalue1] = useState('0') return ( <> { Tab 3 { - setTab1value(value) + setTabvalue1(value) }} style={{ '--nutui-tabs-titles-font-size': '12px' }} > diff --git a/src/packages/tabs/demos/taro/demo13.tsx b/src/packages/tabs/demos/taro/demo13.tsx index c164c37747..3bd2a2b201 100644 --- a/src/packages/tabs/demos/taro/demo13.tsx +++ b/src/packages/tabs/demos/taro/demo13.tsx @@ -15,24 +15,18 @@ const Demo13 = () => { }} > - Tab 1 - Tab 1 - Tab 1 - Tab 1 - Tab 1 - Tab 1 - Tab 1 - Tab 1 + {Array(8) + .fill(null) + .map((_, index) => ( + Tab 1 + ))} - Tab 2 - Tab 2 - Tab 2 - Tab 2 - Tab 2 - Tab 2 - Tab 2 - Tab 2 + {Array(8) + .fill(null) + .map((_, index) => ( + Tab 2 + ))} Tab 3 diff --git a/src/packages/tabs/demos/taro/demo14.tsx b/src/packages/tabs/demos/taro/demo14.tsx index ff23a23f50..5997a4d5a2 100644 --- a/src/packages/tabs/demos/taro/demo14.tsx +++ b/src/packages/tabs/demos/taro/demo14.tsx @@ -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('0') + const [tabvalue, setTabvalue] = useState('0') return ( <> { - setTab2value(value) + setTabvalue(value) }} > - - Tab 1 - - - Tab 1 - - - Tab 1 - - - Tab 1 - - - Tab 1 - - - Tab 1 - - - Tab 1 - - - Tab 1 - + {Array(8) + .fill(null) + .map((_, index) => ( + Tab 1 + ))} Tab 2 Tab 3 diff --git a/src/packages/tabs/demos/taro/demo19.tsx b/src/packages/tabs/demos/taro/demo19.tsx index e512ff8af2..a739808306 100644 --- a/src/packages/tabs/demos/taro/demo19.tsx +++ b/src/packages/tabs/demos/taro/demo19.tsx @@ -3,20 +3,20 @@ import { Tabs } from '@nutui/nutui-react-taro' import { Text } from '@tarojs/components' const Demo19 = () => { - const [tab6value, setTab6value] = useState('0') - const list5 = Array.from(new Array(2).keys()) + const [tabvalue, setTabvalue] = useState('0') + const list = Array.from(new Array(2).keys()) return ( <> { - setTab6value(value) + setTabvalue(value) }} activeType="smile" direction="vertical" > - {list5.map((item) => ( + {list.map((item) => ( Tab {item} diff --git a/src/packages/tabs/demos/taro/demo20.tsx b/src/packages/tabs/demos/taro/demo20.tsx index 0d0defadf0..5f906bb8e6 100644 --- a/src/packages/tabs/demos/taro/demo20.tsx +++ b/src/packages/tabs/demos/taro/demo20.tsx @@ -2,23 +2,23 @@ import React, { useState } from 'react' import { Tabs } from '@nutui/nutui-react-taro' const Demo20 = () => { - const [tab8value, setTab8value] = useState('0') - const [tab9value, setTab9value] = useState('0') + const [tabvalue, setTabvalue] = useState('0') + const [tabvalue1, setTabvalue1] = useState('0') return ( <> { - setTab8value(value) + setTabvalue(value) }} direction="vertical" > { - setTab9value(value) + setTabvalue1(value) }} direction="horizontal" > diff --git a/src/packages/tabs/demos/taro/demo21.tsx b/src/packages/tabs/demos/taro/demo21.tsx index d495c07bc0..dc648b01b4 100644 --- a/src/packages/tabs/demos/taro/demo21.tsx +++ b/src/packages/tabs/demos/taro/demo21.tsx @@ -3,7 +3,7 @@ import { Tabs } from '@nutui/nutui-react-taro' const Demo21 = () => { const [tabvalue, setTabvalue] = useState('0') - const [tab2value, setTab2value] = useState('0') + const [tabvalue1, setTabvalue1] = useState('0') return ( <> { > { - setTab2value(value) + setTabvalue1(value) }} direction="vertical" > diff --git a/src/packages/tabs/demos/taro/demo23.tsx b/src/packages/tabs/demos/taro/demo23.tsx index 2cdfdfc21b..26bddf40dc 100644 --- a/src/packages/tabs/demos/taro/demo23.tsx +++ b/src/packages/tabs/demos/taro/demo23.tsx @@ -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', @@ -23,12 +23,12 @@ const Demo23 = () => { return ( <> { return list.map((item) => ( 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}