Vue + typescript uses this.$router.options

if you want to access the route list, you can get the route list by directly this.$router.options in the normal vue project

this.$router.options

but in typescript I can directly access this.$router and see the various properties of the object

but if you get it further, it will cause an error in typescript
error message:

Property "options" does not exist on type "VueRouter".

by looking up information, I know that $router.options is a private api not included in typings
, but I still want to get the route list in $router.options to access
first time typescript instruction

.
Mar.15,2021

you can use this.$router ['options'] to solve


another article on the same question

this ['router']

is used
Menu