problem description
I am the first time to use Vue+typescript to organize a project, and now I encounter a problem, that is, I mount the encapsulated axios to Vue.prototype, and there is no problem in using it, but TS will make an error?
related codes
/ / Please paste the code text below (do not replace the code with pictures)
import api from "./http/api/index"; //api
Vue.prototype.$api = api;
export default class BusinessUser extends Vue {
//http
search(): void {
this.$api.user.getMsg("UK1810000001")
console.log(this);
}
TS error will be reported here
Property"$api" does not exist on type "BusinessUser".
I would like to ask the god how to solve this problem.
but you can still send the request normally and get the requested data