Vue.js 如何从vue fullpage包装器中的子组件调用fullpagejs方法?
我不明白如何从vue子组件调用Vue.js 如何从vue fullpage包装器中的子组件调用fullpagejs方法?,vue.js,fullpage.js,Vue.js,Fullpage.js,我不明白如何从vue子组件调用fullpagejs方法,或者更确切地说,调用不是顶级App.vue组件的任何组件 vue fullpage包装器限制您在整个应用程序中仅使用一次fullpage组件,因此我无法在任何子组件中使用this.$refs.fullpage.api调用任何方法 我想让一些可点击的元素触发导航方法,比如moveTo嵌套在较低级别的组件中 作者打算如何让vue应用程序使用App.vue之外的方法 我所能找到的唯一一件作品似乎相当粗糙;我让子组件通过$root.children
fullpagejs
方法,或者更确切地说,调用不是顶级App.vue
组件的任何组件
vue fullpage包装器限制您在整个应用程序中仅使用一次fullpage组件,因此我无法在任何子组件中使用this.$refs.fullpage.api
调用任何方法
我想让一些可点击的元素触发导航方法,比如moveTo
嵌套在较低级别的组件中
作者打算如何让vue应用程序使用App.vue之外的方法
我所能找到的唯一一件作品似乎相当粗糙;我让子组件通过$root.children[0]
从App.vue调用方法
我是否应该以某种方式将整页引用作为道具传递
我知道道具和事件,但要编写代码将事件冒泡到4-5层的子组件上似乎非常乏味
我尝试使用单独的vue实例创建事件总线,但该事件总线实例无法访问App.vue中的方法
感觉好像我错过了什么
fullpage是否只要求您在App.vue
中整合对fullpage api的所有方法调用?来自文档:
//where --> var vm = new Vue({...}) if calling it from outside.
vm.$refs.fullpage.build();
//or, when calling it from inside the Vue component methods:
this.$refs.fullpage.build();
您还可以使用窗口对象中的全局对象:fullpage\u api
。例如:fullpage\u api.moveSectionDown()
如果您知道如何改进您的用例,请随意创建一个pull请求,我很乐意将其合并到组件中!:) 从文档中:
//where --> var vm = new Vue({...}) if calling it from outside.
vm.$refs.fullpage.build();
//or, when calling it from inside the Vue component methods:
this.$refs.fullpage.build();
您还可以使用窗口对象中的全局对象:fullpage\u api
。例如:fullpage\u api.moveSectionDown()
如果您知道如何改进您的用例,请随意创建一个pull请求,我很乐意将其合并到组件中!:)