提交 0b53ed19 编写于 作者: inkwalk's avatar inkwalk

update

上级 3edb3a2c
......@@ -16,8 +16,10 @@
</view>
</view>
<view class="uni-btn-v uni-common-mt">
<button type="primary" @tap="getNetworkType">获取设备网络状态</button>
<button v-if="hasNetworkType === true && networkType === 'wifi'" class="uni-common-mt" type="primary" @tap="getConnectedWifi">获取 wifi 信息</button>
<button type="primary" @tap="getNetworkType">获取设备网络状态</button>
<!-- #ifdef MP-WEIXIN -->
<button v-if="hasNetworkType === true && networkType === 'wifi'" class="uni-common-mt" type="primary" @tap="getConnectedWifi">获取 wifi 信息</button>
<!-- #endif -->
<button class="uni-common-mt" @tap="clear">清空</button>
</view>
</view>
......@@ -56,27 +58,26 @@
this.hasNetworkType = false,
this.networkType = '',
this.connectedWifi = ''
},
},
// #ifdef MP-WEIXIN
getConnectedWifi() {
const that = this
uni.startWifi({
success: function() {
console.log("=========== startWifi success =========")
uni.getConnectedWifi({
success: function(res) {
const { wifi } = res
that.connectedWifi = JSON.stringify(wifi)
},
fail: function(res) {
console.log("=========== getConnectedWifi fail res =========", res)
}
})
},
fail: function(res) {
console.log("=========== startWifi fail res =========", res)
}
})
}
}
// #endif
}
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册