【问题标题】:vue-resource http request gives:' _.isArray is not a functionvue-resource http 请求给出:' _.isArray 不是函数
【发布时间】:2017-01-20 15:31:30
【问题描述】:

我正在尝试从位于localhost:3000 的服务器获取对象。当我转到浏览器中的地址时,我可以看到该对象。

我的前端运行在我的Vue 实例的methods 属性中定义的这个函数:

goToTutors: function(){
    this.step='tutors';
    this.$http.get('http://localhost:3000/tutors').then(
        function(tutors) {
            console.log("Tutors found!");
        },
        function(error) {
            console.log(error);
        });
}

但在我的浏览器控制台中,我看到的只是错误:

Uncaught TypeError: _.isArray is not a function at vue-resource.js:172

谁能指出错误的原因?

【问题讨论】:

  • 看起来 vue-resource 正在寻找 lodash (_.isArray 是一种 lodash 方法)但找不到。尝试将其添加到您的页面。

标签: node.js vue.js vue-resource


【解决方案1】:

尝试更新您的 vue 资源版本。它对我有用。

【讨论】:

    猜你喜欢
    • 2017-06-01
    • 2018-10-20
    • 2019-05-17
    • 2014-02-08
    • 2017-05-10
    • 2018-04-11
    • 2014-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多