Does vue have any advantages in turning plug-ins into separate modules?

for example, what are the advantages of making a stand-alone module below? are there any other plug-ins you can talk about in detail

import Vue from "vue"
import axios from "axios"
Vue.prototype.$http = axios
import Vue from "vue"
import axios from "axios";
Vue.prototype.$axios = axios;
export default({
});
Aug.20,2021
A

plug-in is a collection of complex functions. You can use it directly when needed, and you don't need to remove it directly. You can also reuse


first of all, according to the code example you give, this is not called making a plug-in into a separate module. This is called prototype chain mount
has no advantages. It is said on cookbook that if you use webpack, The browserfy module tool is better to use directly with import (rather than mounting to the prototype chain)
https:/ / cn.vuejs.org/v2/cookb.

Menu