让更新资料旁边的图标在原地进行旋转
WXML文件
<view class="update" bindtap="upDate">
更新资料
<image class=" " animation='{{animationData}}' style="width:23rpx;height:23rpx; margin-left:5rpx; margin-top:2rpx;" src="http://dodui.oss-cn-shenzhen.aliyuncs.com/20201106RegDoduiDoshop_xcx/updata.png">
</image>
</view>
JS文件
//更新资料
upDate: function () {
// 顺时针旋转实例
var animation = wx.createAnimation({
duration: 1000,
timingFunction: 'ease'
})
// 逆时针旋转实例
var animation1 = wx.createAnimation({
duration: 10,
timingFunction: 'ease'
})
animation.rotate(450).step()
this.setData({
animationData: animation.export()
})
setTimeout(function () {
animation1.rotate(0).step()
this.setData({
animationData: animation1.export()
})
}.bind(this), 1300);
getUserInfo().then(res => {
console.log("个人资料: ", res)
this.setData({
userInfo: res.data,
});
wx.showToast({
title: '更新成功',
icon: 'success',
duration: 1000,
mask: true
})
});
}