import React, { Component } from 'react';

import { Menu, Dropdown, Icon, Input ,InputNumber } from 'antd';

export default class WidthDropDown extends Component {
    constructor(props) {
        super(props)
        this.state = {
            visible: false
        }
    }
    handleVisibleChange = (flag) => {
        this.setState({ visible: flag });
    }
    onPressEnter = (e) => {
//console.log(e)
this.props.handleChangeWidth(e)
        // this.props.handleChangeWidth(e.target.value)
        // e.target.value = ''
        // this.setState({
        //     visible:false
        // })
    }
    onblur = (e) => {
        e.target.value = ''
    }
    render() {
        const { item } = this.props
        return (
            <Dropdown overlay={
                    <Menu style={{ width: '100px' }}>
                        <Menu.Item  >
                            {/* <Input placeholder="请输入宽度" onPressEnter={this.onPressEnter} onBlur={this.onblur} /> */}
                            <InputNumber min={140} max={50000} defaultValue={140} onChange={this.onPressEnter} />
                        </Menu.Item>
                    </Menu>
             
            } onVisibleChange={this.handleVisibleChange}
                visible={this.state.visible}>
                <div className="ant-dropdown-link" >
                    {item.title}<Icon type="down" />
                </div>
            </Dropdown>
        )
    }
}