贪吃蛇game.wxml代码_xml

<!--pages/game/game.wxml-->

<view class="container">

  <view>玩家得分:{{score}}</view>

  <canvas canvas-id="gameCanvas/>

  <view class="btnBox">

    <button type="primarysize="minibind:tap="changeDirectiondata-direct = "{{2}}" data-img = "up"></button>

    <view>

      <button type="primarysize="minibind:tap="changeDirectiondata-direct = "{{1}}" data-img = "left"></button>

      <button type="primarysize="minibind:tap="changeDirectiondata-direct = "{{-2}}" data-img = "down"></button>

      <button type="primarysize="minibind:tap="changeDirectiondata-direct = "{{-1}}" data-img="right"></button>

    </view>

    <button type="primarysize="minibind:tap="initGame">重新开始</button>

  </view>

</view>