无法解决指令:滚动到vue-scrollto
我正在使用VUE JS(我是VUE JS上的新手)制作Web应用程序,特别是Vue2.x。我想单击菜单的元素,然后滚动到该元素。我曾想过使用此工具 https://vue-scrollto.netlify.app/examples/examples/ 正是我想做的。
问题在于,当我重复与示例中的代码相同时,我会收到错误“ [Vue Warn]:无法解决指令:滚动到 ”。这是我的代码:
<div :class="{subelementos: isOpenAndroid}">
<div class="subelementos2">
<p v-scroll-to="'#prueba'" class="subelementos3" @click="menuClick('android')">Principios</p>
</div>
</div>
然后在另一个组件中:
<div id="prueba">
<p>TEXTEXT</p>
</div>
我不知道有人是否熟悉此工具。我想我缺少一些重要的东西。
PS:也许是一个愚蠢的问题(对此很抱歉),但是,您认为必须使用NUXTJS吗?在工具的官方页面上,我认为是可选的 https:/ /vue-scrollto.netlify.app/docs/#nuxt-js 。
----编辑----
HTML,CSS和JS在同一文件中,特别是在.vue文件上。我认为也许我必须将外部库导入到我的.VUE文件中。
I am making a web application with Vue js(i am a newbie on vue js), specifically Vue 2.x. I want to click in an element of a menu, and then scroll to the that element. I have thought to use this tool https://vue-scrollto.netlify.app/examples/ as it is exactly what i want to do.
The problem is that when I repeat the same the code as in the examples, I receive the error "[Vue warn]: Failed to resolve directive: scroll-to". Here is my code:
<div :class="{subelementos: isOpenAndroid}">
<div class="subelementos2">
<p v-scroll-to="'#prueba'" class="subelementos3" @click="menuClick('android')">Principios</p>
</div>
</div>
And then in another component:
<div id="prueba">
<p>TEXTEXT</p>
</div>
I don't know if someone is familiar with this tool. I think i am missing something important.
PS: Maybe is a stupid question(sorry about that) but, do you think is mandatory to use Nuxtjs? On the official page of the tool it is mentioned, but I think is optional https://vue-scrollto.netlify.app/docs/#nuxt-js.
----EDIT----
The HTML, CSS and JS are in the same file, specifically on a .vue file. I think that maybe I have to import an external library into my .vue file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误表明您尚未注册该指令。
vue-scrollto
文档描述设置指令。插件会自动注册引擎盖下的指令,您可以使用vue.use()
:demo
The error indicates that you haven't registered the directive.
The
vue-scrollto
docs describe how to setup the directive. The plugin automatically registers the directive under the hood, and you can install the plugin in your app's entry point withVue.use()
:demo