8f81b50bffe82cbc281712280136259db461ad7c.svn-base 884 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <component :is="myComponent" ref="detail" />
  3. </template>
  4. <script>
  5. import { mapGetters } from 'vuex'
  6. import groupErrorAnalysis from './group'
  7. import PastureErrorAnalysis from './pasture'
  8. import Cookies from 'js-cookie'
  9. export default {
  10. name: 'ErrorAnalysis',
  11. components: { groupErrorAnalysis, PastureErrorAnalysis },
  12. data() {
  13. return {
  14. myComponent: null
  15. }
  16. },
  17. computed: {
  18. ...mapGetters(['ispastureuse'])
  19. },
  20. mounted() {
  21. this.detailComponent()
  22. },
  23. methods: {
  24. detailComponent() {
  25. if (Cookies.get('ispastureuse') == 0) {
  26. const vue = this
  27. var myComponent = () => import('./pasture/index.vue')
  28. return vue.myComponent = myComponent
  29. } else {
  30. const vue = this
  31. var myComponent = () => import('./group/index.vue')
  32. return vue.myComponent = myComponent
  33. }
  34. }
  35. }
  36. }
  37. </script>