Home > @elux/react-taro > SwitchProps

SwitchProps interface

内置UI组件

Signature:

export interface SwitchProps 

Remarks

用来控制子元素的渲染方式:如果非空子元素大于0,则渲染第一个非空子元素,否则将渲染props.elseView, 与 `<Else>` 的区别在于:<Else> 渲染所有非空子元素

Example

<Switch elseView={<NotFound />}>
 {subView === 'detail' && <Detail />}
 {subView === 'list' && <List />}
</Switch>

Properties

PropertyTypeDescription
childrenReactNode
elseView?ReactNode(Optional)