Skip to content

Commit c75fb54

Browse files
committed
fix: bug fix
1 parent 2626f92 commit c75fb54

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

frontend/src/views/chat/chat-block/ChartPopover.vue

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,22 @@ const props = defineProps({
1717
},
1818
})
1919
const 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+
}
2336
const emits = defineEmits(['typeChange'])
2437
const 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>

0 commit comments

Comments
 (0)