<template>
  <div>
    <Main v-if="showPage === 'Main'" @changePage="changePage" @getobj="getobj" @backPage="backPage"></Main>
    <Details v-else-if="showPage === 'Details'" @changePage="changePage" :editObj="editObj.editObj"
      :mainobj="editObj.mainobj"></Details>
  </div>
</template>

<script setup>
import Main from "./Main/index.vue";
import Details from "./Details/index.vue";
import { reactive, ref } from "vue";

let showPage = ref('Main')
let editObj = reactive({
  editObj: null,
  mainobj: null
})
const changePage = (val, obj) => {
  if (obj) {
    editObj.editObj = obj
  } else {
    editObj.editObj = null
  }
  showPage.value = val

}
const backPage = (obj) => {
  if (obj) {
    editObj.mainobj = obj
  } else {
    editObj.mainobj = null
  }
}
</script>
 
<style lang = "scss" scoped></style>