watch: {
        hasChanges: {
            immediate: true,

            handler(val) {
                if (val) {
                    window.onbeforeunload = () => ({});
                } else {
                    window.onbeforeunload = null;
                }
            },
        },
    },