Vue.use() is often used in main.js to introduce global components or instructions or eventbus, etc.
Vue.use(*) parameters are divided into two types, one is an object and the other is a function
1. If the parameter is an object, it must include the install method parameter which is Vue.
// demo1.js
export default {
install(Vue) {
console.log(Vue)
}
}
//main.js
import demo1 from './demo1.js'
Vue.use(demo1)
2. The parameter is a function, which will be used as the install method. The parameter of the function is the Vue object.
// demo2.js
function demo2(Vue){
console.log(Vue)
}
export default demo2
//main.js
import demo2 from './demo2.js'
Vue.use(demo2)