UnisKB/ui/src/views/chat/index.vue

43 lines
922 B
Vue
Raw Normal View History

2025-06-03 08:08:49 +00:00
<template>
<component
:applicationAvailable="applicationAvailable"
:is="currentTemplate"
2025-06-17 03:58:35 +00:00
:application_profile="chatUser.application"
2025-06-03 08:08:49 +00:00
:key="route.fullPath"
v-loading="loading"
/>
</template>
<script setup lang="ts">
2025-06-17 03:58:35 +00:00
import { ref, computed } from 'vue'
2025-06-03 08:08:49 +00:00
import { useRoute } from 'vue-router'
import useStore from '@/stores'
2025-06-17 03:58:35 +00:00
2025-06-03 08:08:49 +00:00
const route = useRoute()
2025-06-17 03:58:35 +00:00
const { chatUser } = useStore()
2025-06-03 08:08:49 +00:00
const components: any = import.meta.glob('@/views/chat/**/index.vue', {
2025-06-16 04:08:09 +00:00
eager: true,
2025-06-03 08:08:49 +00:00
})
const {
query: { mode },
2025-06-16 04:08:09 +00:00
params: { accessToken },
2025-06-03 08:08:49 +00:00
} = route as any
2025-06-17 03:58:35 +00:00
2025-06-03 08:08:49 +00:00
const currentTemplate = computed(() => {
let modeName = ''
if (!mode || mode === 'pc') {
2025-06-17 03:58:35 +00:00
modeName = 'pc'
2025-06-03 08:08:49 +00:00
} else {
modeName = mode
}
const name = `/src/views/chat/${modeName}/index.vue`
return components[name].default
})
2025-06-17 03:58:35 +00:00
const loading = ref(false)
2025-06-03 08:08:49 +00:00
const applicationAvailable = ref<boolean>(true)
</script>
<style lang="scss"></style>