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