<template>
  <div class="container">
    <route v-ref:route ></route>
    <readmeter-top v-if='showTop' :toptext='pageName'></readmeter-top>
  </div>
</template>
<script>
  import Vue from 'vue'
  export default {
    title: 'home',
    data () {
      return {
        pageName: '',
        showback: 'false',
        nowPage: 'home-page',
        showTop: false
      }
    },
    events: {
      // 'menu' (param) {
      //   this.$dispatch('showFullPage')
      //   this.showTop = true
      //   this.pageName = param
      //   if (param === '计划下载') {
      //     this.$refs.route.init('plan-down')
      //   } else if (param === '表单上传') {
      //     this.$refs.route.init('plan-update')
      //   } else if (param === '抄表管理') {
      //     this.$refs.route.init('read-meter')
      //   } else if (param === '抄表记录') {
      //     this.$refs.route.init('read-meter-info')
      //   } else {
      //     this.showTop = false
      //     this.$refs.route.init('home')
      //   }
      // },
      'changemeterpage' (val, param) {
        console.log(val)
        // this.$dispatch('showFullPage')
        // if (param === 'save') {
        //   window.currentPage = '抄表录入'
        // } else {
        //   window.currentPage = undefined
        // }
        this.$refs.route.init('read-meter-changan', {param: val, type: param})
      }
      // 'returnPage' () {
      //   if (window.currentPage && window.currentPage === '抄表录入') {
      //     this.showTop = true
      //     this.pageName = '抄表管理'
      //     window.currentPage = undefined
      //     this.$refs.route.init('read-meter')
      //     return
      //   }
      //   this.$dispatch('hideFullPage')
      //   this.showTop = false
      //   this.$refs.route.init('readmeter-home')
      // },
      // 'hand-success' (type) {
      //   this.$dispatch('showFullPage')
      //   HostApp.alert('抄表成功')
      //   if (type === 'save') {
      //     this.$refs.route.init('read-meter')
      //   } else {
      //     this.$refs.route.init('read-meter-info')
      //   }
      // }
    },
    ready () {
      this.$refs.route.init('read-meter')
      this.showTop = false
    }
  }
</script>
<style>
  .have_top {
    padding-top: 60px;
  }
</style>
