I am running into an error of accessing this.$route. Every time I try I use it I get the error
Uncaught TypeError: Cannot read properties of undefined (reading '$router')
I have tried having a const self = this;
at the top and trying to use self but that doesn't work.
I also tried accessing it after 1 second as I may be trying to access it before Vue is initialized but that also doesn't work. Doesn't anyone have any ideas? Thanks
const self = this;
is bad practice, use arrow functions or .bind(this) to the function this.$router
? Also, it will be better to add the block of code you are trying to address. <script>console.log(this.$router)</script>
?