$默认为全局property,使用Vue.prototype. $xx声明的property是不想污染全局作用域,一些组件引入后会留一个实例property如echartimport echarts from 'echarts',留下echarts实例供我们调用。
使用vue.prototype. $echarts = echarts后,我们就能直接使用 $echarts避免重名

Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐