求助,关于在手机上预览小程序动画过渡缺失的问题
新手刚接触小程序开发,在做一个输入框聚焦后上移的动画时,开发工具内预览正常,但在手机上预览就出现缺少动画过渡的情况,输入框直接从起点调到了终点,请帮忙解决一下
var animation = wx.createAnimation({ duration: 1000, timingFunction: "ease-in-out" , }); this .animation = animation; animation.translateY(-170).step(); this .setData({ animationData: animation.export() }) |
5 回复
wxml代码:
< view id = 'search' > < input animation = "{{animationData}}" placeholder = "{{content}}" bindfocus = 'input_focus' bindblur = 'input_blur' /> </ view > |
js代码:
Page({ data:{ animationData:{}, content: "시작하자!" , }, input_focus: function (){ // clear placeholder this .setData({ content: "" , }); // set animation var animation = wx.createAnimation({ duration: 1000, timingFunction: "ease-in-out" , }); this .animation = animation; animation.translateY(-170).step(); this .setData({ animationData: animation.export() }) }, input_blur: function (){ this .setData({ content: "시작하자!" , }) } }) |