jd-opensource / jd-opensource/taro-ui

在Tabs标签页中使用高阶组件,高阶组件中的Children无法正常工作

Open
#665 2 comments 0 reactions 0 assignees View on GitHub
help wanted stale
Dominant language
TypeScript
Stars
4.7k
Forks
740
PR merge metrics
No merged PRs in 30d

Description

**问题描述**
在Tabs标签页中使用高阶组件,若HOC的props.children为三元运算符时(如下图所示),其中的onClick是无法触发的。

**复现步骤**
1. 新建一个普通组件;
2. 从 taro-ui 引入 AtTabs、AtTabsPane ;
3. 新建一个 HOC ,该 HOC 可展示 props.children ;
4. 页面结构如下:
```tsx
// 外层Tab
// 内层Tab

{[1].length > 0
? [1].map(() => (


{
// not work
console.log(1);
}}
>
1



))
: 2}

```
5. 点击 Button ,控制台没有输出

**期望行为**
控制台输出1

**报错信息**

**系统信息**
Taro CLI 1.2.26 environment info:
System:
OS: Windows 10
Binaries:
Node: 10.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD

**补充信息**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.