-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Vue warn]: Failed to resolve directive: waypoint #13
Comments
I might be wrong since I never installed a plugin directly into a single file component but I think you misunderstood how plugins should be initialized. Plugins should be "installed" before the master vue's init. You will find this in the main.js file ( So, try to move |
Thanks for getting back to me! So I have moved import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld
}
]
}) and here's my main.js file import Vue from 'vue'
import App from './App'
import router from './router'
import Child from '@/components/child'
import VueWaypoint from 'vue-waypoint'
// Waypoint plugin
Vue.use(VueWaypoint)
Vue.config.productionTip = false
Vue.component('child', Child)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
}) Additionally, I have Greensock installed and I have imported it in one component and am able to use it. I have a pretty bare bones setup for this test, and I'm really not sure what I'm doing wrong with your plugin. Here is my component where I use Greensock: <template>
<div class="child">
<div class="animated">Animated div</div>
</div>
</template>
<script>
import {TweenMax} from 'gsap'
export default {
data: () => ({
someData: 'string'
}),
mounted () {
const animateDiv = document.querySelector('.animated')
animateDiv.setAttribute('style', 'height: 100px; width: 100px; background-color: blue; position: relative; margin: auto; align-content: center; border-radius: 50px')
TweenMax.to(animateDiv, 2, {left:500, rotation:50, yoyo: true, repeat:-1})
}
}
</script> Thanks again for your help! Would love to figure this out, it seems like a really useful plugin. |
I think the problem is here: Can you try the directive inside App.vue? |
I'm having this same issue. I've tried it in both the main entry point file and in the component I'm trying to use the directive in. |
I also had the same issue, it worked after I changed from
to
|
@colloquet reply just found the problem. The library is not correctly exported as library by the webpack configuration. I just pushed the related hotfix (b591d0c).
to
This will work and it's tested. Beside that @juliewongbandue, I would suggest you not to use Thanks for this, I will keep this open for two days if something is missing. |
Got it!! Thanks so much @scaccogatto. Super helpful. |
@scaccogatto I see, thanks again for your work on this library. |
Hi there,
I'm fairly new to vue.js and am just trying to see if I can use this for a project that requires some animation on scroll. The vue.js CLI was used to scaffold the project. I simply included the sample code you have in your readme, but keep getting a
[Vue warn]: Failed to resolve directive: waypoint
in the console. Here's my component:I may just be using
Vue.use()
incorrectly? Please let me know if you have any tips!The text was updated successfully, but these errors were encountered: