1234567891011121314151617181920212223242526272829303132333435363738 |
- <template>
- <component :is="myComponent" ref="detail" />
- </template>
- <script>
- import { mapGetters } from 'vuex'
- import groupInventoryManagement from './group'
- import pastureInventoryManagement from './pasture'
- import Cookies from 'js-cookie'
- export default {
- name: 'InventoryManagement',
- components: { groupInventoryManagement, pastureInventoryManagement },
- 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>
|