| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 | <template>  <div class="app-container">    <el-tabs v-model="activeName" @tab-click="handleTabClick">      <el-tab-pane label="功能参数" name="first">        <component :is="myComponent1" ref="detail1" />      </el-tab-pane>      <el-tab-pane label="预警参数" name="second">        <keep-alive>          <component :is="myComponent2" ref="detail2" />        </keep-alive>      </el-tab-pane>    </el-tabs>  </div></template><script>export default {  name: 'DefaultParameter',  data() {    return {      activeName: 'first',      myComponent1: null,      myComponent2: null    }  },  created() {    this.detailComponent()  },  methods: {    detailComponent() {      if (this.activeName == 'first') {        const vue = this        var myComponent1 = () => import('./function/index.vue')        return vue.myComponent1 = myComponent1      }    },    handleTabClick() {      if (this.activeName == 'first') {        const vue = this        var myComponent1 = () => import('./function/index.vue')        return vue.myComponent1 = myComponent1      } else if (this.activeName == 'second') {        const vue = this        var myComponent2 = () => import('./earlyWarning/index.vue')        return vue.myComponent2 = myComponent2      }    }  }}</script><style lang="scss" scoped></style>
 |