@@ -3,6 +3,7 @@ import type { ChatMessage } from '@/api/chat.ts'
33import DisplayChartBlock from ' @/views/chat/component/DisplayChartBlock.vue'
44import ChartPopover from ' @/views/chat/chat-block/ChartPopover.vue'
55import { computed , ref , watch } from ' vue'
6+ import { useClipboard } from ' @vueuse/core'
67import { concat } from ' lodash-es'
78import type { ChartTypes } from ' @/views/chat/component/BaseChart.ts'
89import ICON_BAR from ' @/assets/svg/chart/icon_bar_outlined.svg'
@@ -39,6 +40,7 @@ const props = withDefaults(
3940 }
4041)
4142
43+ const { copy } = useClipboard ()
4244const loading = ref <boolean >(false )
4345const { t } = useI18n ()
4446const addViewRef = ref (null )
@@ -224,10 +226,11 @@ function showSql() {
224226// addViewRef.value?.optInit(recordeInfo)
225227// }
226228
227- function copy () {
229+ function copyText () {
228230 if (props .message ?.record ?.sql ) {
229- navigator .clipboard .writeText (props .message .record .sql )
230- ElMessage .success (t (' embedded.copy_successful' ))
231+ copy (props .message .record .sql ).then (() => {
232+ ElMessage .success (t (' embedded.copy_successful' ))
233+ })
231234 }
232235}
233236
@@ -455,7 +458,7 @@ watch(
455458 :sql =" message.record?.sql"
456459 style =" margin-top : 12px "
457460 />
458- <el-button v-if =" message.record?.sql" circle class =" input-icon" @click =" copy " >
461+ <el-button v-if =" message.record?.sql" circle class =" input-icon" @click =" copyText " >
459462 <el-icon size =" 16" >
460463 <icon _copy_outlined />
461464 </el-icon >
0 commit comments