// 展示离开弹框提示
const showDialog = () => {
console.log('isStatusChange.value====>', isStatusChange.value)
dialogVisible.value = isStatusChange.value ? false : true
}
// 监听浏览器返回按钮
const browserGoBack = () => {
if (window.history && history.pushState) {
//这里有没有都无所谓,最好是有以防万一
history.pushState(null, null as unknown as string, document.URL)
window.addEventListener('popstate', showDialog, false)
}
}
onUnmounted(() => {
window.removeEventListener('popstate', showDialog, false)
})