这个想法来自看直播时看主播斗地主时常常因为没有记牌器,判断失误致使输豆,因此作了这个记牌器。估计不会有人用 😆,就看成练手,熟悉小程序的整个开发流程哈哈。 没想到提交次日就审核经过了vue
1.可选一副牌或两副牌git
2.点击相应牌减小对应牌的数量, 数量为0时该图标变灰github
3.可撤销,撤销操做仅保留最近100个点击操做小程序
4.重置操做会清空全部操做记录布局
<div class="gird-container"> <div class="gird-item" v-for="(poker, index) in pokers" :key="index"> <card :poker="poker" :index="index" @handleHuase="handleHuase" @handleWang="handleWang"> </card> </div> </div>
// 点击操做 handleHuase (obj) { // 这里用来记录操做历史 this.updateHistory.push(JSON.parse(JSON.stringify(this.pokers))) if (this.pokers[obj.index][obj.huase] > 0) { this.pokers[obj.index][obj.huase] -= 1 this.pokers[obj.index].count -= 1 } else { this.pokers[obj.index][obj.huase] = this.defaultCount this.pokers[obj.index].count += 1 } }
// 撤销操做 rollback () { let pokers = this.updateHistory[this.updateHistory.length - 1] this.pokers = pokers this.updateHistory.pop(this.updateHistory.length - 1) }
https://github.com/jinggoing/...this