【发布时间】:2017-08-06 11:34:31
【问题描述】:
我正在尝试消除一个运行 500 毫秒的函数。按照此处的文档:
https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed
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)
}
但是在运行此函数时,我在控制台中出现错误Uncaught ReferenceError: _ is not defined 我已尝试删除_。在 debounce 前面,但它说 debounce 也没有定义。
【问题讨论】:
-
_ 是下划线或 lodash,一个外部库,而不是 Vue。
标签: javascript vue.js vuejs2