import React, { Component } from 'react'
import {$emit} from "../utill/bus.js"
export class Top extends Component {
    state = {
        val: ""
    }
    changeVal(e) {
        console.log(e.target.value);

        this.setState({
            val: e.target.value
        })
    }
    fn() {
        alert(1)
    $emit("aaa",this.state.val)
    }
    render() {
        return (
            <div>
                我是top
                <input type="text" value={this.state.val} onChange={this.changeVal.bind(this)} /><button onClick={this.fn.bind(this)}>搜索</button>
            </div>
        )
    }
}

export default Top
