微信小程式條件渲染
- 在小程式app。json中添加
- 需要先擷取位置資訊
"permission": {
"scope.userLocation": {
"desc": "你的位置資訊将用于小程式位置接口的效果展示"
}
},
- 才可以擷取wifi資訊
wx.startWifi({ //初始化wifi
success: function(res) {
console.log(res.errMsg + "11654");
wx.getWifiList({ //成功後,就可以擷取清單了
success: function(res) {
console.log(res);
//清單擷取成功後,要到事件裡提取
wx.onGetWifiList(function(res) {
console.log("擷取wifi清單");
console.log(res.wifiList); //在這裡提取清單資料
that.wifiList = res.wifiList
})
}
});
}
});