<script setup lang="ts" name="DiscoverIndex">
import { ref } from 'vue'
import list from './list.vue'
import addEditDiscovery from './addEditDiscovery.vue'
import discoverProcess from './discoverProcess.vue'
import discoverResult from './discoverResult.vue'
import discoverHistory from './discoverHistory.vue'

const widget = {
  list: list,
  addEditDiscovery: addEditDiscovery,
  discoverProcess: discoverProcess,
  discoverResult: discoverResult,
  discoverHistory: discoverHistory
}

const page = ref('list')
const params = ref({})

function onChangePage(val: string, param?: any) {
  page.value = val
  params.value = param ?? {}
}
</script>

<template>
  <component :is="widget[page]" v-bind="params" @page="onChangePage" />
</template>
