<template>
  <component :is="myComponent" ref="detail" />
</template>
<script>
import { mapGetters } from 'vuex'
import GroupProcessAnalysis from './group'
import PastureProcessAnalysis from './pasture'
import Cookies from 'js-cookie'
export default {
  name: 'ProcessAnalysis',
  components: { GroupProcessAnalysis, PastureProcessAnalysis },
  data() {
    return {
      myComponent: null
    }
  },
  computed: {
    ...mapGetters(['ispastureuse'])
  },
  mounted() {
    this.detailComponent()
  },
  methods: {
    detailComponent() {
      if (Cookies.get('ispastureuse') == '1') {
        const vue = this
        var myComponent = () => import('./group/index.vue')
        return vue.myComponent = myComponent
      } else {
        const vue = this
        var myComponent = () => import('./pasture/index.vue')
        return vue.myComponent = myComponent
      }
    }

  }
}
</script>
