29 lines
925 B
Plaintext
29 lines
925 B
Plaintext
![]() |
<view class="container">
|
||
|
<view class="title">蓝牙跳绳连接</view>
|
||
|
|
||
|
<!-- 开启蓝牙按钮 -->
|
||
|
<button bindtap="startBluetooth">开启蓝牙</button>
|
||
|
|
||
|
<!-- 搜索设备按钮 -->
|
||
|
<button bindtap="searchDevices" wx:if="{{!isSearching}}">搜索设备</button>
|
||
|
<button wx:else>正在搜索...</button>
|
||
|
|
||
|
<!-- 设备列表 -->
|
||
|
<view class="device-list">
|
||
|
<block wx:for="{{devices}}" wx:key="deviceId">
|
||
|
<button class="device-item" bindtap="connectDevice" data-device="{{item}}">
|
||
|
{{item.name ? item.name : item.deviceId}} <!-- 如果设备没有名称,显示 deviceId -->
|
||
|
</button>
|
||
|
</block>
|
||
|
</view>
|
||
|
|
||
|
<!-- 连接状态 -->
|
||
|
<view class="status">连接状态: {{status}}</view>
|
||
|
|
||
|
<!-- 跳绳计数 -->
|
||
|
<view class="data">跳绳计数: {{skipCount}}</view>
|
||
|
|
||
|
<!-- 断开连接按钮 -->
|
||
|
<button bindtap="disconnectDevice" wx:if="{{connected}}">断开连接</button>
|
||
|
</view>
|