Javascript VueJS 2未捕获引用错误:\未使用反盎司定义

Javascript VueJS 2未捕获引用错误:\未使用反盎司定义,javascript,vue.js,vuejs2,Javascript,Vue.js,Vuejs2,我正在尝试将函数从500毫秒的运行中去除。以下是此处的文档: 但运行此函数时,控制台中出现错误UncaughtReferenceError:u未定义,我已尝试删除u。在debounce前面,但它表示也没有定义debounce。在示例中,VueJS使用外部库(如下划线JS或lodash)中的debounce函数 要使用它,只需在npm模块中安装后将其包含在文件中,如下所示: import _ from 'lodash'; new Vue({ // ... methods: {

我正在尝试将函数从500毫秒的运行中去除。以下是此处的文档:


但运行此函数时,控制台中出现错误UncaughtReferenceError:u未定义,我已尝试删除u。在debounce前面,但它表示也没有定义debounce。

在示例中,VueJS使用外部库(如下划线JS或lodash)中的debounce函数

要使用它,只需在npm模块中安装后将其包含在文件中,如下所示:

import _ from 'lodash';

new Vue({
    // ...
    methods: {
        // Get the data needed for this page
        fetchData: _.debounce(function () {
            this.$http.get('widgets/quickfindordernumber/' + this.quickFindOrderNumber).then(function (response) {
                console.log(response.body)
            }, function (error) {
                console.log(error);
            });
        }, 500)
    }
});

_是下划线或lodash,是一个外部库,而不是Vue。
import _ from 'lodash';

new Vue({
    // ...
    methods: {
        // Get the data needed for this page
        fetchData: _.debounce(function () {
            this.$http.get('widgets/quickfindordernumber/' + this.quickFindOrderNumber).then(function (response) {
                console.log(response.body)
            }, function (error) {
                console.log(error);
            });
        }, 500)
    }
});