花半天时间写了个估计不会有人用的小程序,居然还审核经过了

这个想法来自看直播时看主播斗地主时常常因为没有记牌器,判断失误致使输豆,因此作了这个记牌器。估计不会有人用 😆,就看成练手,熟悉小程序的整个开发流程哈哈。 没想到提交次日就审核经过了vue

截图

思路比较简单只有一个页面

1.可选一副牌或两副牌git

2.点击相应牌减小对应牌的数量, 数量为0时该图标变灰github

3.可撤销,撤销操做仅保留最近100个点击操做小程序

4.重置操做会清空全部操做记录布局

开发上选择的是 mpvue http://mpvue.com/

而后直接使用grid布局对卡牌进行排列

<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)
}

git地址

https://github.com/jinggoing/...this

小程序码

相关文章
相关标签/搜索