453d2ca0a2a346154a538d13fe453d2f730727d2.svn-base 822 B

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