html
<view class="content">
<block wx:for="{{list}}" wx:key="{{index}}">
<view animation="{{item.value.animation}} class="list">
<view class="title" bindtap="onLoadNews" data-key="{{item.key}}"
{{item.value.title}}
</view>
js
page ({
data:{
list:[]
}
//监听显示
onshow:function() {
var animation=wx.createAnimation({
duration:1000,
timingFunction:"ease".
this.animation=animation
js
onFavorite:function(e){
var that=this,
key=e.currentTarget.dataset.key
value=e.currentTarget.dataset.value
data=that.data.list
this.animation.opacity(0).step();
var animation=this.animation.export();
var arrayTmp=[];
hotapp.post(key.value.function(res){
console.log(e.currentTarget.dataset.key);
var newdata=data.map{function(item){
if (item.key==key){
item value.animation=animation;
}else{
that.animation.opacity(1).step();
item.value.animation=that.animation.export();
arrayTmp.push(item);
}
return item;
});
this.setData({list:newdata});
setTimeout(function(){
that.setData({list:arrayTmp});
wx.showToast({
title:"成功“,
},
icon:'success',
duration:2000
})
},1200);
})