如何解决无效的属性...设置为...缺少插件? gsap.registerPlugin
在Vue3中,如果我尝试在gsap
生命周期挂钩中尝试使用mounted()
动画,但是可以在onMounted
内的setup
挂钩中尝试,得到这些警告:
Invalid property rotationY set to 45 Missing plugin? gsap.registerPlugin()
Invalid property rotationX set to 45 Missing plugin? gsap.registerPlugin()
我的setup
:
setup() {
const comments = ref(null);
const test = function() {
gsap.fromTo(
comments,{ rotationY: 45 },{
rotationX: 45,ease: 'back.in(1)',},'mousein'
);
};
onMounted(test);
return { comments };
},
Vue文档说onMounted
中的setup
与mounted()
相同,那么我怎么能得到不同的结果?
解决方法
由于comments
是ref
,因此您必须使用其value
属性来访问模板引用:
const test = function() {
gsap.fromTo(
// BEFORE:
// comments,// AFTER:
comments.value,/*...*/
);
};
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。