Skip to content

Conversation

liulinboyi
Copy link

PR信息

这个 PR 是什么类型? (至少选择一个)

这个 PR 涉及以下平台:

  • 所有小程序

最小复现

仓库
https://github.com/liulinboyi/taro-removeEventListener-bug

代码

import { View, Text } from '@tarojs/components'
import { useState } from 'react'

export default function Index() {
  const [flag, setFlag] = useState(true)

  return (
    <View className='index'>
      <View className='wrapper'>
        {
          flag ?
            <Text className='box' onClick={() => setFlag(prev => !prev)}>Demo {flag ? '1' : '0'}</Text> :
            <Text className='box'>Other {flag ? '1' : '0'}</Text>
        }
      </View>
    </View>
  )
}

上述代码编译后运行在微信小程序中时,点击Demo 1时,在控制台会抛出错误如下:

demo_bug

修复

修复后如下:

demo_bug_2

This was referenced Jul 6, 2024
@liqinuo liqinuo changed the base branch from main to 3.x July 16, 2024 06:50
@ZEJIA-LIU ZEJIA-LIU deleted the branch NervJS:3.x July 16, 2024 07:16
@ZEJIA-LIU ZEJIA-LIU closed this Jul 16, 2024
@ZEJIA-LIU ZEJIA-LIU reopened this Jul 16, 2024
This was referenced Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants