0👍
Do you want to trigger the function from one page and let it execute on another one?
Otherwise you could use lifecycle hooks as mounted() or created() when page loads. It will trigger a function as soon as page is loaded.
Source:stackexchange.com