Issue
I have managed to make my function accessible using the plugin attribute in the nuxt.config.js file and can then call the function under mounted on each page. I need this function to run in the head tag and be accessible on each page. Is there a quick way for me to do this rather than just adding to each page individually? I tried adding it as a script under the head section in the nuxt.config.js but that caused me some problems as the script needed to contain a function.
Thanks!
Solution
To run a function every route, you can use watch route in your root layout
watch: {
$route() {
//logic go here
}
}
Answered By - lord_shen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.