Skip to content

Commit

Permalink
doc: 修复文档报错和错误示例 (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
nullptr-z committed Apr 2, 2022
1 parent 8b407ec commit b2f5b69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react-date-input/README.md
Expand Up @@ -249,7 +249,7 @@ ReactDOM.render(<Demo />, _mount_);
| placeholder | 输入框提示文字 | String | - |
| allowClear | 是否显示清除按钮 | Boolean | true |
| format | 格式化时间,规则查看 [`<formatter>`](#/components/formatter) 文档 | String | `YYYY/MM/DD` |
| onChange | 选择一天时调用。 | Function(selectedDate:Date, dateRange: Array<Date>) | - |
| onChange | 选择一天时调用。 | Function(selectedDate:Date, dateRange: Array\<Date>) | - |
| popoverProps | 将参数传递给 [`<Popover>`](#/components/popover) 组件 | Object | - |
| datePickerProps | 将参数传递给 [`<DatePicker>`](#/components/date-picker) 组件 | Object | - |
| disabled | 组件 [`<Input>`](#/components/input) 的属性,禁用日历 | Boolean | - |
Expand Down
8 changes: 6 additions & 2 deletions packages/react-modal/README.md
Expand Up @@ -90,6 +90,7 @@ class Demo extends React.Component {
this.state = {
visible: false,
}
this.time = null
}
onClick() {
this.setState({ visible: !this.state.visible });
Expand All @@ -106,14 +107,17 @@ class Demo extends React.Component {
confirmText="确定按钮"
cancelText="取消按钮"
type="danger"
onCancel={() => console.log('您点击了取消按钮!')}
onCancel={() => {
clearTimeout(this.time)
console.log('您点击了取消按钮!')
}}
onClosed={this.onClosed.bind(this)}
onConfirm={() => {
console.log('确定回调!, 这里是利用Promise等执行完成再去关闭窗口');
return new Promise((resolve, reject) => {
const random = Math.random();
console.log('测试,随机值大于 0.5 执行 resolve 事件,否则 执行 reject 触发 catch 错误', random, random > 0.5)
setTimeout(random > 0.5 ? resolve : reject, 3000);
this.time = setTimeout(random > 0.5 ? resolve : reject, 3000);
}).catch(() => {
// 可以通过下面方式,阻止弹框消失
// throw new Error();
Expand Down

0 comments on commit b2f5b69

Please sign in to comment.