<template>
  <web-view :src="url" @message="handleGetMessage"/>
</template>

<script>
import {h5BaseUrl} from '@/utils/config'
export default {
  data() {
    return {
      url:'',
      msgObj:{}
    };
  },
  onLoad(options) {
    let chapterId=options.chapterId
    let fromPage=options.fromPage||''
    const timestamp=new Date().getTime()
    const token=this.$store.state.user.token
    this.url=`${h5BaseUrl}/hzyb/report/chapterdetail?chapterId=${chapterId}&fromPage=${fromPage}&token=${token}&timestamp=${timestamp}#wechat_redirect`
  },
  onShareAppMessage() {
    return {
      title:this.msgObj.title,
      path:`/pages-report/chapterDetail?chapterId=${this.msgObj.chapterId}`
    }
  },
  methods: {
    handleGetMessage(e){
      const data=e.detail.data[e.detail.data.length-1]
      console.log('h5传来的数据',data);
      this.msgObj=data
    }
  }
};
</script>

