Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs: 选项卡 Demo:数量多,滚动操作在微信模拟器不生效 #1801

Closed
vczyh opened this issue Dec 20, 2023 · 2 comments · Fixed by #1800
Closed

Tabs: 选项卡 Demo:数量多,滚动操作在微信模拟器不生效 #1801

vczyh opened this issue Dec 20, 2023 · 2 comments · Fixed by #1800

Comments

@vczyh
Copy link
Contributor

vczyh commented Dec 20, 2023

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.2

平台

weapp

重现链接

https://github.com/vczyh/taro-nutui-test/tree/tab-scroll

重现步骤

git checkout tab-scroll
npm install
npm run build:weapp

期望的结果是什么?

自动滚动

实际的结果是什么?

不滚动

环境信息

No response

其他补充信息

No response

@oasis-cloud
Copy link
Collaborator

给 tabs 加下 name 属性。<Tabs name="xxx"

@vczyh
Copy link
Contributor Author

vczyh commented Dec 21, 2023

给 tabs 加下 name 属性。<Tabs name="xxx"

加上可以了,我又发现了另外一个问题:

如果给TabPane value 指定值,不使用默认索引,这个时候不但不会滚动而且会报错:
CleanShot 2023-12-21 at 10 50 28@2x

export default function Index() {
  
  const [tab4value, setTab4value] = useState('a');
  
  return (
    <>
      <Tabs
        name='e8882930-da8e-4214-a2b3-853fbe3c9f15'
        value={tab4value}
        onChange={(value) => {
          setTab4value(value as string)
        }}
      >
        <Tabs.TabPane title='低阶特卖' value='a'>低阶特卖</Tabs.TabPane>
        <Tabs.TabPane title='上新日' value='b'>上新日</Tabs.TabPane>
        <Tabs.TabPane title='百亿补贴' value='c'>百亿补贴</Tabs.TabPane>
        <Tabs.TabPane title='今日聚超值' value='d'>今日聚超值</Tabs.TabPane>
        <Tabs.TabPane title='真好真便宜' value='e'>真好真便宜</Tabs.TabPane>
      </Tabs>
    </>
  )
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants