<script>
import Greet from "./components/Greet.vue";
import AppHyperSpectral from "./AppHyperSpectral.vue";
import APPDataview from "./DataView/APPDataview.vue";
import EventBus from "./eventBus.js";
export default {
  components: {
    Greet,
    AppHyperSpectral,
    APPDataview
  },
  data() {
    return {
      currentView: 'AppHyperSpectral', // 当前显示的视图
      viewList: ['AppHyperSpectral', 'APPDataview'],
      indexofcomponent: 0,
    };
  },
  mounted() {
   EventBus.on('changemainvue', this.onchangemainvue);
   console.log(window.__TAURI__);
  },
  methods: {
    onchangemainvue(){
      // 切换到下一个视图
      this.indexofcomponent++;
      if (this.indexofcomponent >= this.viewList.length) {
        this.indexofcomponent = 0;
      }
      this.currentView = this.viewList[this.indexofcomponent];
    }
  }
};
</script>

<template>
  <keep-alive>
    <component 
      :is="currentView" 
      style="user-select: none; width: 100vw; height: 100vh;"
    />
  </keep-alive>
</template>

<style scoped>

</style>
