Why are some vue source codes added through Vue.prototype.fun or directly Vue.fun?

  javascript, question


At the beginning of today, I read vue source code, and I was a little confused.

Can putVueThink of it as a class (i.e. class Vue{} in ES6 or function Vue(){}) in ES5).

In the picture,Vue.useYesVueClass method of, that is, directly through theVue.use()Called method, which is used to extend theVueIf you want to use some plug-ins in your project, such asElement UI, you need to introduce through this method.

However, throughVue.pototype.funThe method defined is in aVueThe method used within the component, that is, if you want to use the methodFunYou need to use itVueYou cannot use it directly unless you call it within a defined component.Vue.funTo call.