From 87bce04d7cdf5ca427757071e7cc3b0847b64dfc Mon Sep 17 00:00:00 2001
From: gerson <1405270578@qq.com>
Date: 星期一, 01 七月 2024 11:37:25 +0800
Subject: [PATCH] question 传 id

---
 src/views/project/ch/home/component/waterRight/center.vue |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/views/project/ch/home/component/waterRight/center.vue b/src/views/project/ch/home/component/waterRight/center.vue
index 952529c..4efb59e 100644
--- a/src/views/project/ch/home/component/waterRight/center.vue
+++ b/src/views/project/ch/home/component/waterRight/center.vue
@@ -17,7 +17,7 @@
 				class="main_item flex items-center cursor-pointer"
 				v-for="(item, index) in state.exampleContent"
 				:key="index"
-				:class="{ main_item_active: item.sample_id === state.exampleIndex }"
+				:class="{ main_item_active: item.sample_id === activeSampleId }"
 				@click="changeExample(item)"
 			>
 				<div class="left flex items-center justify-center" :class="['color' + index]">
@@ -141,6 +141,8 @@
 import { Search } from '@element-plus/icons-vue';
 import { onMounted, reactive, computed } from 'vue';
 import { getSelectSample } from '/@/api/ai/chat';
+import emitter from '/@/utils/mitt';
+import { activeSampleId } from '/@/stores/chatRoom';
 let state = reactive({
 	exampleContent: [],
 	exampleRandomContent: [],
@@ -148,7 +150,6 @@
 		{ ID: 1, Name: '鎻愰棶绀轰緥' },
 		{ ID: 2, Name: '鎸囦护妯℃澘' },
 	],
-	exampleIndex: 0,
 	isShowAdvanceExample: false,
 	activeName: 1,
 	searchInput: '',
@@ -285,7 +286,9 @@
 };
 
 const changeExample = (item) => {
-	state.exampleIndex = item.sample_id;
+	emitter.emit('updateChatInput',item.sample_question)
+	activeSampleId.value = item.sample_id
+
 };
 //鎹竴鎵�
 const batchChange = () => {
@@ -296,6 +299,7 @@
 //楂樼骇绀轰緥
 const advanceExampleClick = () => {
 	state.isShowAdvanceExample = true;
+
 };
 //鍒囨崲鍒版寚浠�/鎻愰棶
 const handleTabClick = (item) => {

--
Gitblit v1.9.3