zzzccc0812
V2EX  ›  Vue.js

vue-cli3.0 +TypeScript 类型“VueRouter”上不存在属性“options”

  •  1
     
  •   zzzccc0812 · Apr 1, 2020 · 3666 views
    This topic created in 2416 days ago, the information mentioned may be changed or developed.

    大家好, 我在写 VUE+TS 的时候遇到了一个问题 请求大佬

    Element implicitly has an 'any' type because expression of type '"options"' can't be used to index type 'VueRouter'.
    类型“VueRouter”上不存在属性“options”
    
    
    // 在写 router 的时候用到了 options 但是会提示错误 本人目前只找到了一种解决方法就是去 Node_modules 里面去修改 请问大佬们 有没有其他更好的解决办法
    this.$router["options"].routes
    
    2 replies  •  2020-04-02 19:24:05 +08:00
    geshansuiyue
    geshansuiyue
    Apr 2, 2020
    1
    自己写个定义文件吧。
    zzzccc0812
    zzzccc0812
    OP
    Apr 2, 2020
    2
    @geshansuiyue 大佬您好我尝试过是写在 types/然后建一个对应的.d.ts 文件吗 我貌似好像不太行
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4824 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 02:35 · PVG 10:35 · LAX 18:35 · JFK 21:35
    ♥ Do have faith in what you're doing.