File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
frontend/src/views/chat/chat-block Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,22 @@ const props = defineProps({
1717 },
1818})
1919const currentIcon = computed (() => {
20- return props .chartTypeList .find ((ele ) => ele .value === props .chartType || ele .value === ' table' )
21- .icon
20+ if (props .chartType === ' table' ) {
21+ const [ele] = props .chartTypeList || []
22+ if (ele .icon ) {
23+ return ele .icon
24+ }
25+ return null
26+ }
27+ return props .chartTypeList .find ((ele ) => ele .value === props .chartType ).icon
2228})
29+
30+ const firstItem = () => {
31+ if (props .chartType === ' table' ) {
32+ const [ele] = props .chartTypeList || []
33+ handleDefaultChatChange (ele || {})
34+ }
35+ }
2336const emits = defineEmits ([' typeChange' ])
2437const handleDefaultChatChange = (val : any ) => {
2538 emits (' typeChange' , val .value )
@@ -29,7 +42,11 @@ const handleDefaultChatChange = (val: any) => {
2942<template >
3043 <el-popover trigger =" click" popper-class =" chat-type_select" placement =" bottom" >
3144 <template #reference >
32- <div class =" chat-select_type" :class =" chartType && chartType !== 'table' && 'active'" >
45+ <div
46+ @click =" firstItem"
47+ class =" chat-select_type"
48+ :class =" chartType && chartType !== 'table' && 'active'"
49+ >
3350 <component :is =" currentIcon" />
3451 <el-icon style =" transform : scale (0.75 )" class =" expand" size =" 16" >
3552 <icon _expand_down_filled ></icon _expand_down_filled >
You can’t perform that action at this time.
0 commit comments