index.vue 735 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <template v-if="state.isOnline">
  3. <onlineChat
  4. ref="ref_chat"
  5. :ID="ID"
  6. :test="test"
  7. @hangUp="state.isOnline = false"
  8. />
  9. </template>
  10. <template v-else>
  11. <normalChat ref="ref_chat" :ID="ID" :test="test" />
  12. </template>
  13. </template>
  14. <script setup lang="ts">
  15. import { nextTick, onMounted, reactive, ref } from 'vue'
  16. import normalChat from './normal.vue'
  17. import onlineChat from './online.vue'
  18. const props = defineProps({
  19. online: { default: false },
  20. test: { default: false },
  21. ID: { default: '' },
  22. })
  23. const state: any = reactive({
  24. isOnline: props.online,
  25. })
  26. const ref_chat = ref()
  27. defineExpose({
  28. init: () => ref_chat.value?.init(),
  29. })
  30. </script>
  31. <style lang="scss" scoped></style>