@ubrorg/card
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -41,4 +41,10 @@ function qs(params) { | ||
dislike: 'https://gw.alicdn.com/tfs/TB1KNNvhPMZ7e4jSZFOXXX7epXa-40-40.svg' | ||
} | ||
}, | ||
isFavorite: false | ||
}, | ||
didMount: function didMount() { | ||
this.setData({ | ||
isFavorite: this.props.favoriteStatus || this.props.dataItem.favoriteStatus | ||
}); | ||
}, | ||
methods: { | ||
@@ -49,4 +55,4 @@ handleLikeTap: function handleLikeTap(e) { | ||
var id = e.target.dataset.id; | ||
var favoriteStatus = this.props.favoriteStatus; | ||
var url = favoriteStatus ? '/api/users/favorites/del/1.0' : '/api/users/favorites/add/1.0'; | ||
var isFavorite = this.data.isFavorite; | ||
var url = isFavorite ? '/api/users/favorites/del/1.0' : '/api/users/favorites/add/1.0'; | ||
this.$page.request({ | ||
@@ -61,3 +67,3 @@ url: url, | ||
_this.setData({ | ||
favoriteStatus: !favoriteStatus | ||
isFavorite: !isFavorite | ||
}); | ||
@@ -64,0 +70,0 @@ }, |
{ | ||
"name": "@ubrorg/card", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "card", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
17094
110