We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
微信小程序
https://github.com/vdfor/taro-issue-demo-005 小程序基础库: 2.12.0 使用框架: React
最小化仓库运行后,点击改变数据按钮,点击 第一行,从控制台可以看到此时点击事件执行了;点击 第二行/第三行,发现点击事件未执行。
此时,如果使用index作为key,则点击事件均有效。
主要复现代码:
import React, { FC, useState } from 'react' import { View, Button } from '@tarojs/components' import './index.scss' const Index: FC = () => { const [list, setList] = useState(['张三', '李四', '王二', '赵五', '王六']); const changeList = () => { setList(['王六', '王二', '赵五']) } return ( <View> <Button onClick={changeList}>改变数据</Button> <View className='list'> {list.map(i => ( <View className='list-item' key={i} onClick={() => { console.log('item click', i) }} > {i} </View> ))} </View> </View> ) } export default Index;
列表加上key顺序变化时,所有列表项点击事件均可执行。
列表加上key顺序变化时,部分列表项点击事件失效
Taro CLI 3.0.6 environment info: System: OS: Windows 10 Binaries: Node: 12.18.2 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Users\vdfor\AppData\Roaming\npm\yarn.CMD npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
The text was updated successfully, but these errors were encountered:
#6983 也是这个问题
Sorry, something went wrong.
fix(runtime): 修复列表顺序变化时,部分列表项点击事件失效的问题,fix #7227
296174b
817ac15
luckyadam
Successfully merging a pull request may close this issue.
相关平台
微信小程序
复现仓库
https://github.com/vdfor/taro-issue-demo-005
小程序基础库: 2.12.0
使用框架: React
复现步骤
最小化仓库运行后,点击改变数据按钮,点击 第一行,从控制台可以看到此时点击事件执行了;点击 第二行/第三行,发现点击事件未执行。
此时,如果使用index作为key,则点击事件均有效。
主要复现代码:
期望结果
列表加上key顺序变化时,所有列表项点击事件均可执行。
实际结果
列表加上key顺序变化时,部分列表项点击事件失效
环境信息
The text was updated successfully, but these errors were encountered: