问题描述
我在vue中引入了velocity.js动画,其中velocity.js文档中说可以使用链式动画,就像下面这样
问题出现的环境背景及自己尝试过哪些方法
我在vue中像这样去使用,却报错了vue.esm.js?3153:1741 TypeError: this.$refs.rect.velocity is not a function
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
`
<div class="rect" ref="rect"></div>
`
`
mounted() {
this.$refs.rect.velocity({left: 200 }, { duration: 500 }).velocity("reverse", { duration: 2000 });
}
`
因为你没有引入jq 这是jq的写法 建议看看velocity的文档。
无jq的情况下写法:
Velocity(this.$refs.rect, {left: 200 }, { duration: 500 })
第一个V注意大写