這是Vue.js的問題,一般我試圖在我的.vue實例中使用'scrollMonitor'函數(通過main.js導入),但它給了我一個典型的「this.scrollMonitor不是一個函數」錯誤自定義js庫(scrollMonitor)內部主要Vue實例內部組件共享
mounted() {
let watcher = this.$scrollMonitor(this.$refs.nicer)
}
在main.js ScrollMonitor庫似乎正確導入(控制檯顯示什麼是預期):
import scrollMonitor from 'scrollmonitor'
Vue.use(scrollMonitor)
console.log(scrollMonitor)
再次,主要目標是使用.vue文件內的scrollMonitor功能(在vue組件實例中)。對不起,如果我在這裏丟失了一些愚蠢的東西 - 我已經在該文件中使用了一些其他庫,如Vue-Resource,所以問題不在'filepath'中,而是以我使用scrollMonitor功能的方式進行,任何幫助都非常感謝, 謝謝 !
謝謝,這是有道理的 –