/** * @author oldj * @blog http://oldj.net */ 'use strict' import React from 'react' import Agent from '../Agent' import './frame.less' export default class MyFrame extends React.Component { constructor (props) { super(props) } componentDidMount () { Agent.on('esc', () => { this.onCancel() }) } onOK () { this.props.onOK() } onCancel () { this.props.onCancel() } renderFootButtons () { let html = [] let {lang} = this.props html.push(
{this.props.cancel_title || lang.cancel}
) html.push(
{this.props.ok_title || lang.ok}
) return html } render () { if (!this.props.show) { return null } return (
{this.props.head}
{this.props.body}
{this.renderFootButtons()}
) } }