54c5fbab8bb340bf86ea756db7254c71d77b02a4.svn-base 914 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <component :is="myComponent" ref="detail" />
  3. </template>
  4. <script>
  5. import { mapGetters } from 'vuex'
  6. import groupInventoryManagement from './group'
  7. import pastureInventoryManagement from './pasture'
  8. import Cookies from 'js-cookie'
  9. export default {
  10. name: 'InventoryManagement',
  11. components: { groupInventoryManagement, pastureInventoryManagement },
  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') == 1) {
  26. const vue = this
  27. var myComponent = () => import('./group/index.vue')
  28. return vue.myComponent = myComponent
  29. } else {
  30. const vue = this
  31. var myComponent = () => import('./pasture/index.vue')
  32. return vue.myComponent = myComponent
  33. }
  34. }
  35. }
  36. }
  37. </script>