代码之家  ›  专栏  ›  技术社区  ›  PenAndPapers

Vue插件错误-返回未定义

  •  0
  • PenAndPapers  · 技术社区  · 7 年前

    GlobalDataMethods.install = function(Vue, options) {
        Vue.getAPIData = function(paramObj) {
    
        }
    
        Vue.getFormData = function(formId) {
    
        }
    }
    
    Vue.use(GlobalDataMethods);
    
    1 回复  |  直到 7 年前
        1
  •  3
  •   Bert Jeffrey Shen    7 年前

    GlobalDataMethods 需要 某物 install ,但你从来没有 定义 全局数据方法 .

    const GlobalDataMethods = {}
    GlobalDataMethods.install = ...
    Vue.use(GlobalDataMethods)
    

    router definition 是一个 class 这个 安装 added to that class