12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <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">
- <component :is="myComponent2" ref="detail2" />
- </el-tab-pane>
- </el-tabs>
- </div>
- </template>
- <script>
- import Function from './function/index'
- import EarlyWarning from './earlyWarning/index'
- export default {
- name: 'DefaultParameter',
- components: { Function, EarlyWarning },
- 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
- } else if (this.activeName == 'second') {
- const vue = this
- var myComponent2 = () => import('./earlyWarning/index.vue')
- return vue.myComponent2 = myComponent2
- }
- },
- 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>
|