{"id":92827,"date":"2020-03-21T03:28:08","date_gmt":"2020-03-20T19:28:08","guid":{"rendered":"http:\/\/4563.org\/?p=92827"},"modified":"2020-03-21T03:28:08","modified_gmt":"2020-03-20T19:28:08","slug":"vue-cli3-0-typescript-%e7%b1%bb%e5%9e%8bvuerouter%e4%b8%8a%e4%b8%8d%e5%ad%98%e5%9c%a8%e5%b1%9e%e6%80%a7options","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=92827","title":{"rendered":"vue-cli3.0 +TypeScript \u7c7b\u578b\u201cVueRouter\u201d\u4e0a\u4e0d\u5b58\u5728\u5c5e\u6027\u201coptions\u201d"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  vue-cli3.0 +TypeScript \u7c7b\u578b\u201cVueRouter\u201d\u4e0a\u4e0d\u5b58\u5728\u5c5e\u6027\u201coptions\u201d               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zzzccc0812 <\/span>  <span><i><\/i> 26<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5927\u5bb6\u597d, \u6211\u5728\u5199 VUE+TS \u7684\u65f6\u5019\u9047\u5230\u4e86\u4e00\u4e2a\u95ee\u9898 \u8bf7\u6c42\u5927\u4f6c<\/p>\n<pre><code>Element implicitly has an 'any' type because expression of type '\"options\"' can't be used to index type 'VueRouter'. \u7c7b\u578b\u201cVueRouter\u201d\u4e0a\u4e0d\u5b58\u5728\u5c5e\u6027\u201coptions\u201d   \/\/ \u5728\u5199 router \u7684\u65f6\u5019\u7528\u5230\u4e86 options \u4f46\u662f\u4f1a\u63d0\u793a\u9519\u8bef \u672c\u4eba\u76ee\u524d\u53ea\u627e\u5230\u4e86\u4e00\u79cd\u89e3\u51b3\u65b9\u6cd5\u5c31\u662f\u53bb Node_modules \u91cc\u9762\u53bb\u4fee\u6539 \u8bf7\u95ee\u5927\u4f6c\u4eec \u6709\u6ca1\u6709\u5176\u4ed6\u66f4\u597d\u7684\u89e3\u51b3\u529e\u6cd5 this.$router[\"options\"].routes <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"986978\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : geshansuiyue <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u81ea\u5df1\u5199\u4e2a\u5b9a\u4e49\u6587\u4ef6\u5427\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"986979\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zzzccc0812 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @geshansuiyue \u5927\u4f6c\u60a8\u597d\u6211\u5c1d\u8bd5\u8fc7\u662f\u5199\u5728 types\/\u7136\u540e\u5efa\u4e00\u4e2a\u5bf9\u5e94\u7684.d.ts \u6587\u4ef6\u5417 \u6211\u8c8c\u4f3c\u597d\u50cf\u4e0d\u592a\u884c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>vue-cli3.0 +TypeS&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/92827"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=92827"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/92827\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=92827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=92827"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=92827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}