perf: 优化

This commit is contained in:
wangdan-fit2cloud 2024-05-28 10:41:36 +08:00
parent 817500de72
commit 057449e3d8
2 changed files with 8 additions and 6 deletions

View File

@ -5,7 +5,7 @@
</el-text>
</div>
<div>
<el-tooltip effect="dark" content="重新生成" placement="top">
<el-tooltip effect="dark" content="换个答案" placement="top">
<el-button text @click="regeneration">
<AppIcon iconName="VideoPlay"></AppIcon>
</el-button>

View File

@ -1,4 +1,4 @@
import { watch, onBeforeMount, onMounted, onBeforeUnmount } from 'vue'
import { nextTick, onBeforeMount, onMounted, onBeforeUnmount } from 'vue'
import { useRoute } from 'vue-router'
import useStore from '@/stores'
import { DeviceType } from '@/enums/common'
@ -9,7 +9,7 @@ const WIDTH = 600
export default () => {
const { common } = useStore()
const _isMobile = () => {
const rect = document.body.getBoundingClientRect()
const rect = document.body?.getBoundingClientRect()
return rect.width - 1 < WIDTH
}
@ -25,9 +25,11 @@ export default () => {
})
onMounted(() => {
if (_isMobile()) {
common.toggleDevice(DeviceType.Mobile)
}
nextTick(() => {
if (_isMobile()) {
common.toggleDevice(DeviceType.Mobile)
}
})
})
onBeforeUnmount(() => {