<template>
  <div class="container">
    <el-radio-group v-model="tabPosition" style="margin: 5px">
      <el-radio-button label="first">开关布局</el-radio-button>
      <el-radio-button label="second">开关状态</el-radio-button>
      <el-radio-button label="third">开关点位列表</el-radio-button>
    </el-radio-group>

    <component :is="currentComponent" :switchMapId="this.switchMapId"/>
  </div>
</template>

<script>
import MapData from "./MapData";
import PointList from "./PointList";
import SwitchStatus from "./SwitchStatus";

export default {
  components: {
    MapData,
    PointList,
    SwitchStatus
  },
  data() {
    return {
      tabPosition: 'first',
      switchMapId: '',
    }
  },
  computed: {
    currentComponent() {
      const components = {
        third: 'PointList',
        first: 'MapData',
        second: 'SwitchStatus'
      }
      return components[this.tabPosition]
    }
  },
  mounted() {
    this.switchMapId = this.$route.query.switchMapId;
    console.log(this.switchMapId,'this.switchMapId');
  },
  methods: {}
}
</script>

<style scoped>
.container {
  width: 100%;
  height: 700px;
  padding: 20px;
  box-sizing: border-box;
}
</style>
