For example, put echarts on the Vue prototype to facilitate the use
of vue2 writing
import Vue from 'vue'
Vue.prototype.$echarts = echarts
How to write vue3
import {
createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)
app.config.globalProperties.$echarts = echarts
Note that in the setup of vue3, it is no longer possible to directly use this.xxxx to use public methods like in vue2.
Use in vue3
import {
getCurrentInstance } from 'vue';
const instance = getCurrentInstance();
//使用全局方法
instance.appContext.config.globalProperties