示例#1
0
	render() {
		let {children} = this.props
		if (children) {
			let props = children.props
			return React.cloneElement(children,{onClick : mergeFuncs(props.onClick,this.handlerClick.bind(this)) })
		}
	}
示例#2
0
	showTarget(targetWrapStyle){
		if(!this.wrap){
			this.wrap = document.createElement('div')
			document.body.appendChild(this.wrap)
		}else{
			ReactDOM.unmountComponentAtNode(this.wrap)
		}
		let {target} = this.props
		if(target){
			assign(this.wrap.style,targetWrapStyle,this.props.wrapStyle)
			let {onConfirm,onChange} = target.props
			let props = {}
			if(onConfirm){
				props.confirm = true
				props.onConfirm = mergeFuncs(onConfirm,this.hideTarget)
			}else if (!onConfirm && onChange) {
				props.onChange = mergeFuncs(onChange,this.hideTarget)
			}
			ReactDOM.render(<div onClick={this.handlerInnerClick}>{React.cloneElement(target,props)}</div>,this.wrap)
		}
	}