From dd58c1d3a27ba48a5df050aab7c586bb9b988914 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 09 四月 2025 18:01:22 +0800 Subject: [PATCH] activeTopMenuStyle --- src/components/chat/chatComponents/contentCbCom/InputSelect.vue | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/src/components/chat/chatComponents/contentCbCom/InputSelect.vue b/src/components/chat/chatComponents/contentCbCom/InputSelect.vue new file mode 100644 index 0000000..22cbaed --- /dev/null +++ b/src/components/chat/chatComponents/contentCbCom/InputSelect.vue @@ -0,0 +1,48 @@ +<template> + <div class="flex flex-col gap-2"> + <span class="text-gray-600 font-normal">{{ `${item?.data?.title}` }}</span> + <div class="flex-items-center gap-5"> + <!-- <span + @click="select(subItem)" + v-for="(subItem, index) in item?.data?.options" + :key="index" + class="flex w-fit items-center cursor-pointer border-solid border px-3 border-gray-300 hover:text-blue-400 rounded-lg" + :class="{ 'cursor-not-allowed': disabled, 'bg-blue-400': subItem === activeOption, 'text-white': subItem === activeOption }" + >{{ subItem }}</span + > --> + <el-select v-if="isSelect" v-model="activeOption" placeholder="璇烽�夋嫨" @change="selectChange"> + <el-option v-for="item in item?.data?.options" :key="item" :label="item" :value="item"></el-option> + </el-select> + <div v-else class="flex items-center gap-3"> + <el-input v-model="inputValue" /> + <el-button type="primary" @click="submitInput">鎻愪氦</el-button> + </div> + </div> + </div> +</template> + +<script setup lang="ts"> +import { computed, ref } from 'vue'; +import { question_stream_reply } from '/@/api/ai/chat'; +import { debounce } from '/@/utils/util'; +const props = defineProps(['item', 'disabled']); +// :class="[...(subItem === activeOption ? ['bg-blue-400', 'text-white'] : []), disabled ? 'cursor-not-allowed' : '']" +// 'bg-blue-400': subItem === activeOption, 'text-white': subItem === activeOption.value +const isSelect = computed(() => props.item?.data?.options?.length > 0); +const inputValue = ref(''); +const activeOption = ref(); +const selectChange = async (option) => { + if (props.disabled) return; + const res = await question_stream_reply({ + select: option, + reply_id: props.item?.data?.reply_id, + }); + if (res.json_ok) { + activeOption.value = option; + } +}; +const submitInput = () => { + selectChange(inputValue.value); +}; +</script> +<style scoped lang="scss"></style> -- Gitblit v1.9.3