久久精品视频18|18xxxx视频|欧美18xxxx|18xxxx中国|俄罗斯18xxxx|成人18禁|黄瓜视频18|污污污视频在线观看

小程序模板網

小程序-記牌器

發布(bu)時間:2018-09-08 09:41 所屬欄目:小程序開發教程

 這個(ge)想法來自(zi)看(kan)直(zhi)播時看(kan)主播斗地主時經常由于沒(mei)有記牌器(qi),判斷失誤導(dao)致(zhi)輸豆,所以做了這個(ge)記牌器(qi)。估計(ji)不會有人用 :laughing:,就當作練手,熟悉小程序的整個(ge)開(kai)發流程哈(ha)哈(ha)。 沒(mei)想到提交第二天就審核(he)通過了

截圖

 

思路比較簡單只有一個頁面

1.可選一副牌(pai)或兩副牌(pai)

2.點擊相(xiang)應(ying)牌(pai)減少(shao)對(dui)應(ying)牌(pai)的數(shu)量, 數(shu)量為0時(shi)該圖(tu)標變(bian)灰

3.可撤銷,撤銷操(cao)(cao)作(zuo)僅保留最近100個點擊操(cao)(cao)作(zuo)

4.重(zhong)置(zhi)操作會(hui)清空所有操作記(ji)錄

開發上選擇的是 mpvuempvue.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)
}
復制代碼


易優(you)小程序(企(qi)業版)+靈活(huo)api+前后代碼開源 碼云倉庫:
本文地址://www.zhutiquan.com/wxmini/doc/course/24788.html 復制鏈接 如(ru)需定制請聯系易(yi)優客服咨詢:

工作日 8:30-12:00 14:30-18:00
周六及部分(fen)節假日提供值班服務

易小(xiao)優
轉人工(gong) ×