Vue插件声明 // 插件定义 MyPlugin.install = function (Vue, options) { // 1. 添加全局⽅方法或属性 Vue.myGlobalMethod = function () { // 逻辑... } // 2. 添加全局资源 Vue.directive('my-directive', { bind (el, binding, vnode, oldVnode