【发布时间】:2017-10-21 09:09:28
【问题描述】:
这是 Vue.js 问题,通常我会尝试在我的 .vue 实例中使用“scrollMonitor”功能(通过 main.js 导入),但它给了我一个典型的“this. scrollMonitor 不是函数的错误
mounted () {
let watcher = this.$scrollMonitor(this.$refs.nicer)
}
在 main.js 中,ScrollMonitor 库似乎已正确导入(控制台显示预期内容):
import scrollMonitor from 'scrollmonitor'
Vue.use(scrollMonitor)
console.log(scrollMonitor)
主要目标还是在 .vue 文件(在 vue 组件实例中)中使用 scrollMonitor 功能。抱歉,如果我在这里遗漏了一些愚蠢的东西-我已经在该文件中使用了其他一些库,例如 Vue-Resource,所以问题不在“文件路径”中,而是在我使用 scrollMonitor 功能的方式上,非常感谢任何帮助,谢谢!
【问题讨论】:
标签: vuejs2