语义UI模态组件onClose with React
Semantic UI modal component onClose with React
我需要一种方法来定义语义模态上的行为,该模态在关闭时执行。
我现在使用的是"门户",但我认为"onClick"事件不起作用,因为这些html元素不在react中。
我有:
componentDidMount() {
console.log('mounting modal', this);
this.node = React.findDOMNode(this);
this.$modal = $(this.node);
this.$icon = $("<i class='close icon' /></i>");
this.$header = $("<div class='header'></div>").html(this.props.header);
this.$content = $("<div class='content'></div>");
this.$modal.append(this.$header);
this.$modal.append(this.$icon);
this.$modal.append(this.$content);
this.renderDialogContent(this.props);
}
componentWillReceiveProps(newProps) {
this.renderDialogContent(newProps);
}
renderDialogContent(props) {
props = props || this.props;
React.render(<div>{props.children}</div>, this.$content[0]);
if (props.isOpen) {
this.$modal
.modal('setting', 'closable', false)
.modal('show');
}
else {
this.$modal.modal('hide modal');
}
}
我该如何定义这种行为?
这里有一些类似的代码。
出于某种原因,我不确定为什么,您不能在模态视图中使用常规的React事件处理程序。
因此,在关闭图标上,我注册了一个jquery-onClick处理程序。
$('#' + id).click(this.props.close);
我通过了与父组件的紧密绑定。
相关文章:
- 设置'这'在React with Inverse Data Flow中
- react native renderRow with button:将rowData推到按钮函数
- Uncatch TypeError:DB.find 不是 React with Meteor 1.3 中的函数
- React-Flux: Error with AppDispatcher.register
- React select with value null
- React + Redux with a rest api?
- 在 React with Jest 中测试模拟表单输入
- FB.Canvas.setAutoGrow() Problems with React JS
- setInterval with setState in React
- React hangs with _dereq_
- Firebase 3.5.2 with create-react-app不起作用
- Typescript 2.0 with React Native
- React Native with WebSocket不起作用
- Webpack error with react
- React JS with Rails -通过URL访问JSON数据
- React和Electron with Bablify: Uncaught TypeError: fs.readFile
- Working with React TransitionGroups
- Subscriptions with react-meteor-data
- 语义UI模态组件onClose with React
- Firebase Login with React Components