common.js export default { login(){ console.log("处理登录事件的方法") } //...真正的高手会积累很多牛逼的方法~~~ } main.js import common from "@/assets/common.js" Vue.prototype.common=common; 在需要的组件中调用common中的login方法: this.common.login()