385127dae5000a9ae3f7afb9070130bfcfe36aaa.svn-base 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="activeName" @tab-click="handleTabClick">
  4. <el-tab-pane label="功能参数" name="first">
  5. <component :is="myComponent1" ref="detail1" />
  6. </el-tab-pane>
  7. <el-tab-pane label="预警参数" name="second">
  8. <keep-alive>
  9. <component :is="myComponent2" ref="detail2" />
  10. </keep-alive>
  11. </el-tab-pane>
  12. </el-tabs>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'DefaultParameter',
  18. data() {
  19. return {
  20. activeName: 'first',
  21. myComponent1: null,
  22. myComponent2: null
  23. }
  24. },
  25. created() {
  26. this.detailComponent()
  27. },
  28. methods: {
  29. detailComponent() {
  30. if (this.activeName == 'first') {
  31. const vue = this
  32. var myComponent1 = () => import('./function/index.vue')
  33. return vue.myComponent1 = myComponent1
  34. }
  35. },
  36. handleTabClick() {
  37. if (this.activeName == 'first') {
  38. const vue = this
  39. var myComponent1 = () => import('./function/index.vue')
  40. return vue.myComponent1 = myComponent1
  41. } else if (this.activeName == 'second') {
  42. const vue = this
  43. var myComponent2 = () => import('./earlyWarning/index.vue')
  44. return vue.myComponent2 = myComponent2
  45. }
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. </style>