我用TS语法创建的vue项目,封装了axios模块,取名叫http
在main.ts中引入
import http from "./http/http"
Vue.prototype.http = http;
然后我在组件中引用出错
ERROR in F:/daimaku2/tsqianduan/src/App.vue(54,12):
54:12 Property 'http' does not exist on type 'CombinedVueInstance<Vue, { tupian: string; }, { huoqudingtu(): void; }, unknown, Readonly<Record<never, any>>>'.
52 | window.console.log("开始获取");
53 | const that2 = this;
> 54 | this.http
| ^
55 | .get("/dingtu/")
56 | .then(function(value: any) {
57 | window.console.log(JSON.parse(value.data));
Version: typescript 3.7.5
Time: 1607ms