Skip to content

render时子组件返回null #2781

Closed
Closed
@MikyChow

Description

问题描述
在render中使用if判断状态然后判断返回子组件时编译后直接返回null

复现步骤
[复现问题的步骤]

  1. 创建子组件并引用
  2. 使用if判断当前状态是否需要展示子组件
  3. 编译weapp后js代码中为null

BWLK6JXNC6TJX0}H_F08Q07

期望行为
返回子组件
报错信息
无报错

[可选]
[根据你的调查研究,出现这个问题的原因可能在哪里?]
使用if关键字导致编译错误、但是未提示。修改成三元运算符后能解决但是相当不好维护

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions