Skip to content

Commit

Permalink
添加控制面板进程的报错提示
Browse files Browse the repository at this point in the history
  • Loading branch information
TSKI433 committed Sep 21, 2022
1 parent 1c673b8 commit 01b75c1
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions src/renderer/control/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ ipcAPI.handleUpdateWindowIds((event, windowIds) => {
// 原来pinia有个方法叫reset……
controlStore.$reset();
});
// 报错信息使用节流函数封装,防止因渲染错误疯狂弹窗
const handleDisplayWindowError = throttle((event, message) => {
ElMessage({
showClose: true,
message: `Display Error: ${message}`,
type: "error",
});
}, 3000);
ipcAPI.handleDisplayWindowError(handleDisplayWindowError);
i18next.changeLanguage(appStore.config.general.language);
const locale = computed(() =>
appStore.config.general.language === "en"
Expand All @@ -62,6 +54,29 @@ const locale = computed(() =>
? ja
: null
);
// 报错信息使用节流函数封装,防止因渲染错误疯狂弹窗
const handleDisplayWindowError = throttle((event, message) => {
ElMessage({
showClose: true,
message: `Display Error: ${message}`,
type: "error",
});
}, 3000);
ipcAPI.handleDisplayWindowError(handleDisplayWindowError);
const handleControlWindowError = throttle((message) => {
ElMessage({
showClose: true,
message: `Control Error: ${message}`,
type: "error",
});
}, 3000);
window.onerror = function (message) {
handleControlWindowError(message);
};
window.addEventListener("unhandledrejection", function (event) {
handleControlWindowError(event.reason.message);
});
</script>

<style lang="scss">
Expand Down

0 comments on commit 01b75c1

Please sign in to comment.