fix: 去除定时存储数据的逻辑

This commit is contained in:
奔跑的面条 2023-05-30 09:34:54 +08:00
parent afc6cf04a1
commit 2f43ddd59b
2 changed files with 32 additions and 2 deletions

View File

@ -330,3 +330,23 @@ export const JSONParse = (data: string) => {
export const setTitle = (title?: string) => {
title && (document.title = title)
}
/**
*
*/
export const addWindowUnload = () => {
// 关闭网页出现离开提示
window.onbeforeunload = function (e) {
e = e || window.event
// 兼容IE8和Firefox 4之前的版本
if (e) {
e.returnValue = '您确定要离开当前页面吗?请确认是否保存数据!'
}
// Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+
return '您确定要离开当前页面吗?请确认是否保存数据!'
}
// 返回销毁事件函数
return () => {
window.onbeforeunload = null
}
}

View File

@ -87,7 +87,14 @@ import { onMounted, computed, provide } from 'vue'
import { chartColors } from '@/settings/chartThemes/index'
import { MenuEnum } from '@/enums/editPageEnum'
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle, colorCustomMerge } from '@/utils'
import {
animationsClass,
getFilterStyle,
getTransformStyle,
getBlendModeStyle,
colorCustomMerge,
addWindowUnload
} from '@/utils'
import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook'
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
@ -110,6 +117,9 @@ const chartEditStore = useChartEditStore()
const { handleContextMenu } = useContextMenu()
const { dataSyncFetch, intervalDataSyncUpdate } = useSync()
//
addWindowUnload()
// scale
provide(SCALE_KEY, null)
@ -186,7 +196,7 @@ onMounted(() => {
//
dataSyncFetch()
//
intervalDataSyncUpdate()
// intervalDataSyncUpdate()
})
</script>