瀏覽代碼

调整搜索到的设备样式

1. 调整样式
kindring 2 年之前
父節點
當前提交
a19052a554
共有 3 個文件被更改,包括 18 次插入7 次删除
  1. 5 1
      pages/index/index.js
  2. 2 2
      pages/index/index.wxml
  3. 11 4
      pages/index/index.wxss

+ 5 - 1
pages/index/index.js

@@ -88,7 +88,11 @@ Page({
       return console.log('设备再次被搜索到');
     }
     console.log(device);
-    this.data.bleDevs.push(device);
+    let arr = this.data.bleDevs;
+    arr.push(device);
+    this.setData({
+      bleDevs:arr
+    })
   },
   tapState(){
     switch(this.data.ble.state){

+ 2 - 2
pages/index/index.wxml

@@ -24,11 +24,11 @@
     <view class="devList">
       <view class="devItem" wx:for="{{bleDevs}}" wx:key="deviceId" >
         <view class="devInfo">
-          <view class="name">{{item.Name}}</view>
+          <view class="name">{{item.name}}</view>
           <view class="devId">{{item.deviceId}}</view>
         </view>
         <view class="option">
-          <view class="btn">连接</view>
+          <view class="custom-info-btn">连接</view>
         </view>
       </view>
     </view>

+ 11 - 4
pages/index/index.wxss

@@ -53,7 +53,7 @@
   width:100%;
   height: 360px;
   display: flex;
-  direction: column;
+  flex-direction: column;
   overflow: hidden;
   margin-top: 10px;
 }
@@ -71,24 +71,31 @@
 }
 .bleDevices .devList .devItem{
   width: 100%;
-  height: 36px;
+  height: 70px;
   border: 1px solid gray;
   margin-bottom: 10px;
   border-radius: 3px;
   display: flex;
   padding: 0 8px;
+  box-sizing: border-box;
+  align-items: center;
+}
+.bleDevices .devList .devItem .devInfo .name,.devId{
+  display: flex;
+  align-items: center;
 }
-
 .bleDevices .devList .devItem .devInfo{
   width: 70%;
 }
 
 .bleDevices .devList .devItem .devInfo .name{
   font-size: 18px;
+  height: 35px;
 }
 
 .bleDevices .devList .devItem .devInfo .devId{
-  font-size: 14px;
+  font-size: 12px;
+  height: 30px;
 }