Skip to content

Commit

Permalink
perf: 颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulter committed Apr 20, 2024
1 parent 0939772 commit 0553675
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions frontend/src/components/PostCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,20 @@ export default {
},
methods: {
randomColor() {
let colors = ["#FFC107", "#42A5F5", "#9CCC65", "#F06292", "#76FF03", "#9E9E9E", "#8D6E63"]
return colors[Math.floor(Math.random() * 100) % colors.length]
let colors = ["#FFC107", "#42A5F5", "#9CCC65", "#F06292", "#9E9E9E", "#8D6E63"]
switch (this.post.status) {
case '待审核':
return colors[1]
case '已通过':
return colors[2]
case '已拒绝':
return colors[3]
case '已取消':
return colors[0]
default:
return colors[4]
}
// return colors[Math.floor(Math.random() * 100) % colors.length]
},
recall() {
this.$emit('recall', this.post.id)
Expand Down

0 comments on commit 0553675

Please sign in to comment.