File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 11<script lang="ts" setup>
2- import { ref } from ' vue'
2+ import { ref , onMounted , onUnmounted } from ' vue'
33import gou_icon from ' @/assets/svg/gou_icon.svg'
44import icon_error from ' @/assets/svg/icon_error.svg'
55import icon_database_colorful from ' @/assets/svg/icon_database_colorful.svg'
66import icon_alarm_clock_colorful from ' @/assets/svg/icon_alarm-clock_colorful.svg'
77import { chatApi , type ChatLogHistory } from ' @/api/chat.ts'
88import { useI18n } from ' vue-i18n'
9+ import { debounce } from ' lodash-es'
910
1011const { t } = useI18n ()
1112const logHistory = ref <ChatLogHistory >({})
1213const dialogFormVisible = ref (false )
1314const drawerSize = ref (' 600px' )
1415
1516function getLogList(recordId : any ) {
16- drawerSize . value = window . innerWidth < 500 ? ' 460px ' : ' 600px '
17+ setDrawerSize ()
1718 chatApi .get_chart_log_history (recordId ).then ((res ) => {
1819 logHistory .value = chatApi .toChatLogHistory (res ) as ChatLogHistory
1920 dialogFormVisible .value = true
2021 })
2122}
2223
24+ const setDrawerSize = debounce (() => {
25+ drawerSize .value = window .innerWidth < 500 ? ' 460px' : ' 600px'
26+ }, 500 )
27+
28+ onMounted (() => {
29+ window .addEventListener (' resize' , setDrawerSize )
30+ })
31+
32+ onUnmounted (() => {
33+ window .removeEventListener (' resize' , setDrawerSize )
34+ })
35+
2336defineExpose ({
2437 getLogList ,
2538})
You can’t perform that action at this time.
0 commit comments