text: import React,{Component} from 'react'
  import Pubsub from 'pubsub-js'
  export default class Sub extends Component{
      state={
          Gdata : ''
      }
      componentDidMount(){
          this.mysub = Pubsub.subscribe('MYMSG',(msg,data)=>{
              console.log('事件名',msg,'数据',data)
              this.setState({
                  Gdata:data
              })
          })
      }
      componentWillUnmount(){
          Pubsub.unsubscribe(this.mysub)
      }
      render(){
          return(
              <div>
                  <h1>订阅到的消息</h1>
                  <p>{this.state.Gdata}</p>
              </div>
          )
      }
  }