Confirm


提示框。Confirm UI 提供与WeLink规范一致的视图。

参数说明

名称 类型 默认值 说明
show bool false 是否显示
title string '' 标题
onOk func 确定事件
okText string '确定' 确定按钮显示文本
onCancel func 取消事件
cancelText string '取消' 取消按钮显示文本
placeholder string '输入文本' 可描述输入字段预期值的提示信息

效果示例

HTML
import React from 'react';
import { Button, Confirm } from '@wecode/react-weui';

export default class ConfirmDemo extends React.Component {
  state = {
    show1: false,
    show2: false
  };

  render() {
    const { show1, show2 } = this.state;
    return (
      <section>
        <Button type="default" onClick={() => this.setState({ show1: true })}>Confirm1</Button>
        <Button type="primary" onClick={() => this.setState({ show2: true })}>Confirm2</Button>

        <Confirm
          title="confirm1"
          show={show1}
          onOk={value => this.setState({ show1: false }, () => console.log(value))}
          onCancel={() => this.setState({ show1: false })}
        />

        <Confirm
          title="confirm2"
          show={show2}
          okText="Yes"
          cancelText="No"
          onOk={value => this.setState({ show2: false }, () => console.log(value))}
          onCancel={() => this.setState({ show2: false })}
        />
      </section>
    );
  }
}

result. ""

    Not Found. ""