我的Nuxt3应用程序中有以下代码:
<template>
<div v-if="conversationId">
<h1>Current conversation: {{ conversationId }}</h1>
<ChatWindow :conversationId="conversationId"/>
</div>
</template>
<script setup>
const conversationId = useState('conversationId');
const showConversation = (convId) => {
conversationId.value = convId;
}
</script>
当调用showConversation('some-other-id')函数时,conversationId会正确更改,但ChatWindow组件保持不变.
我希望ChatWindow组件替换为具有正确对话IDprops 的新组件. 如何做到这一点呢?