index.wxml 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. <xr-demo-viewer
  2. title="小程序通信模版"
  3. intro="通过小程序按钮事件,传递速度变量到 xr-Frame 控制小球移动,并将小球状态同步到小程序侧显示。(工具存在同层渲染问题,请于真机体验)"
  4. code="{{}}"
  5. >
  6. <view class="xr-holder" style="width:{{width}}px;height:{{height}}px;top:{{top}}px;left:{{left}}px;display:block;">
  7. <xr-template-message
  8. disable-scroll
  9. wx:if="{{showXRFrame}}"
  10. id="main-frame"
  11. width="{{renderWidth}}"
  12. height="{{renderHeight}}"
  13. messageData="{{messageData}}"
  14. bindinfoListener="handleInfoListener"
  15. style="width:{{width}}px;height:{{height}}px;top:{{top}}px;left:{{left}}px;display:block;"
  16. />
  17. </view>
  18. <view class="xr-info">
  19. <view class="info-text title">监听列表</view>
  20. <view class="info-text">小球速度:</view>
  21. <view class="info-text">X: {{speedX}} Z: {{speedZ}}</view>
  22. <view class="info-text">小球位置:</view>
  23. <view class="info-text">X: {{posX}} Z: {{posZ}}</view>
  24. </view>
  25. <view class="xr-control" style="top: {{height}}px;">
  26. <button bindtap="tapPlusX">X轴加速</button>
  27. <button bindtap="tapSubX">X轴减速</button>
  28. <button bindtap="tapPlusZ">Z轴加速</button>
  29. <button bindtap="tapSubZ">Z轴减速</button>
  30. </view>
  31. <view class="xr-block">
  32. <button bindtap="tapClose">开启与关闭 xrframe 组件</button>
  33. </view>
  34. </xr-demo-viewer>