<template>
<div class="rice-fish">
  <div style="flex:1">
    <RiceFishMap ref="map" @select="handleMapSelect" area="map" />
  </div>
  <div v-if="showProvince" class="back-btn" @click="handleBack">
    <Icon type="md-arrow-round-back" /> 返回
  </div>
  <div style="flex:1.3">
    <m-animate enter="fadeInRight" leave="fadeOutRight">
      <Nation v-if="!showProvince"></Nation>
      <Province v-else></Province>
    </m-animate>
  </div>
</div>
</template>

<script>
import RiceFishMap from './components/rice-fish/rice-fish-map'
import Nation from './components/rice-fish/nation'
import Province from './components/rice-fish/province'
export default {
  name: 'RiceFish',
  components: {
    RiceFishMap,
    Nation,
    Province,
  },
  data() {
    return {
      showProvince: false,
      disease: '2019',
      options: ['2019', '2018', '2017'],
    }
  },
  computed: {
    flex() {
      return this.showProvince ? '0.5' : '1'
    }
  },
  methods: {
    handleMapSelect() {
      this.showProvince = true
    },
    handleBack() {
      this.showProvince = false
      this.$refs.map.loadNationMap()
    },
  }
}
</script>

<style lang="stylus" scoped>
.rice-fish
  width 100%
  height 100%
  display flex
</style>
