chore: initialize qiming workspace repository
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<chat-conversation-component ref="chatConversationComponentRef" />
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import ChatConversationComponent from '@/subpackages/pages/chat-conversation-component/chat-conversation-component.uvue'
|
||||
import { ref, onUnmounted, getCurrentInstance } from 'vue'
|
||||
import { getCurrentPageFullPath } from '@/utils/common'
|
||||
import { onAddToFavorites, onShow, onHide } from '@dcloudio/uni-app'
|
||||
|
||||
const instance = getCurrentInstance()
|
||||
|
||||
onShow(() => {
|
||||
// 尝试通过实例获取引用,绕过闭包捕获问题
|
||||
// Const variable "chatConversationComponentRef" might not be captured by onShow in MP environment
|
||||
const proxy: any = instance?.proxy
|
||||
const componentRef = proxy?.$refs?.chatConversationComponentRef || proxy?.chatConversationComponentRef
|
||||
|
||||
if (componentRef) {
|
||||
// 在 UTS/小程序中,组件引用可能需要强转或通过特殊方式调用
|
||||
(componentRef as any).triggerResume?.()
|
||||
}
|
||||
})
|
||||
onHide(() => {
|
||||
// Const variable "chatConversationComponentRef" might not be captured by onHide in MP environment
|
||||
const proxy: any = instance?.proxy
|
||||
const componentRef = proxy?.$refs?.chatConversationComponentRef || proxy?.chatConversationComponentRef
|
||||
if (componentRef) {
|
||||
(componentRef as any).triggerHide?.()
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
/**
|
||||
* 事件监听, 刷新首页,重新请求我的收藏数据
|
||||
* 智能体主页中点击收藏或取消收藏后,返回首页,需要刷新首页数据
|
||||
*/
|
||||
uni.$emit('refreshData')
|
||||
})
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 转发给朋友
|
||||
onShareAppMessage(()=>{
|
||||
const proxy: any = instance?.proxy
|
||||
const componentRef = proxy?.$refs?.chatConversationComponentRef || proxy?.chatConversationComponentRef
|
||||
return {
|
||||
title: componentRef?.getAgentInfo()?.name || '',
|
||||
path: getCurrentPageFullPath(),
|
||||
}
|
||||
})
|
||||
|
||||
// 收藏
|
||||
onAddToFavorites(()=>{
|
||||
const proxy: any = instance?.proxy
|
||||
const componentRef = proxy?.$refs?.chatConversationComponentRef || proxy?.chatConversationComponentRef
|
||||
return {
|
||||
title: componentRef?.getAgentInfo()?.name || '',
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user