Tag:html5vue.jsjavascript
Article From:https://segmentfault.com/q/1010000012142335
Question:

When I see the animated effects of other people’s code on the Internet, people can use ref direct this.$refs.a.style.transfrom = “translate (a, b)” to change the style of the element to do animations, but I also do the sameBut I didn’t get the result. I wrote an animated class: class adds, but it works. What’s wrong with me? Is it my fault?

Answer 0:

translateThe variables A and B are defined by you. How can they be wrapped in double quotes?

this.$refs.a.style.transfrom = "translate("+a+"px,"+b+"px)";

I guess you should write this right, but the way ref directly operates the DOM I think is forced to use, it should not be: class to do animation? Or use: style= “…”


Answer 1:

vueI have animations.

Leave a Reply

Your email address will not be published. Required fields are marked *