<template>
  <template v-if="state.isOnline">
    <onlineChat
      ref="ref_chat"
      :ID="ID"
      :test="test"
      @hangUp="state.isOnline = false"
    />
  </template>
  <template v-else>
    <normalChat ref="ref_chat" :ID="ID" :test="test" />
  </template>
</template>

<script setup lang="ts">
import { nextTick, onMounted, reactive, ref } from 'vue'
import normalChat from './normal.vue'
import onlineChat from './online.vue'

const props = defineProps({
  online: { default: false },
  test: { default: false },
  ID: { default: '' },
})
const state: any = reactive({
  isOnline: props.online,
})
const ref_chat = ref()
defineExpose({
  init: () => ref_chat.value?.init(),
})
</script>

<style lang="scss" scoped></style>
