Property'$router' does not exist on type 'Login'.

problem description

vue+typescript+vue-router: has declared global method project compilation error TS2339: Property"$router" does not exist on type "Login".

the environmental background of the problems and what methods you have tried

using this ["$router"] and defining global variables, recompiling will still report the same error

related codes

/ / Please paste the code text below (do not replace the code with pictures)

vuw-shim.d.ts file

declare module "*.vue" {
import Vue from "vue"
  export default Vue;
}

// 
declare module "vue/types/vue" {
  import VueRouter, {Route} from "vue-router"
  import VueI18n from "vue-i18n"
  interface Vue {
    $message: any;
    // $i18n: VueI18n;
    $router: VueRouter;
    $route: Route;
  }
}

call

this.$router.push("/userCenter")

clipboard.png

clipboard.png

Sep.10,2021
Have you solved the problem of

? How to solve it? ask the same question

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-49b30f7-1ca58.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-49b30f7-1ca58.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?