How do I warn a user of unsaved changes before leaving a page in Vue : <p>I have an <code>UnsavedChangesModal</code> as a component that needs to be launched when the user tries to leave the page when he has unsaved changes in the input fields (I have three input fields in the page).</p>

<pre><code>components: {
    UnsavedChangesModal
},
mounted() {
    window.onbeforeunload = '';
},
methods: {
   alertChanges() {

   }
}
</code></pre>
