vue3中的Vue.prototype.xxx = xxx

vue3.0中废除了Vue.prototype.xxx = xxx这种写法
vue2.0如果想挂载一个全局方式或属性到实例上

import Vue from 'vue'

Vue.prototype.$msg = 'Hello Vue'


//其他组件使用this可直接访问
this.$msg

vue3.0

import {
   
    
     createApp } from 'vue'
import App <

猜你喜欢

转载自blog.csdn.net/weixin_44162077/article/details/130100955
xxx