title: How to use Vue.prototype or global variable in Vue 3?
body: <p>Like the title, I want to add Axios into Vue prototype. So when I want to use it, I can use it like <code>this.$axios</code> instead of importing it every time.</p>
  <p><strong>CODE:</strong></p>
  <pre class="lang-js prettyprint-override"><code>//plugins/axios.ts
  
  import axios from 'axios'
  import router from '../router/index'
  
  const errorHandle = (): void =&gt; {};
  
  const instance = axios.create({
    // baseURL: process.env.NODE_ENV == 'development' ? '' : ''
    baseURL: 'http://localhost:3000',
    timeout: 1000 * 12
  });
  
  instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
  
  export default instance
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>import { createApp } from 'vue'
  import App from './App.vue'
  import installElementPlus from './plugins/element'
  import instance from './plugins/axios'
  import router from './router'
  
  const app = createApp(App).use(router)
  installElementPlus(app)
  // app.config.globalProperties.http = instance
  app.config.globalProperties.$axios= instance
  app.mount('#app')
  </code></pre>
  <p>However, there is a problem when I try to use it like this: <code>this.$axios</code>.</p>
  <pre class="lang-sh prettyprint-override"><code>TS2339: Property '$axios' does not exist on type 'ComponentPublicInstance&lt;{}, {}, {}, {}, {}, EmitsOptions, {}, {}, false, ComponentOptionsBase&lt;{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, {}&gt;&gt;'.
  </code></pre>
  <p>How could I fix this problem?</p>