UNPKG

minix-template

Version:

minix template

85 lines (83 loc) 1.57 kB
/* * @Description: * @Autor: tangsj * @Date: 2022-05-05 14:12:02 * @LastEditTime: 2022-05-23 16:43:27 */ import router from '@system.router' import prompt from '@system.prompt' export default { data: { wifiList:[ { name:'connectWifi', // url:'pages/base/canlUse/index', describe:'连接到wifi' }, { name:'getWifiInfo', // url:'pages/base/log/index', describe:'获取已连接wifi信息' } ] }, goRouter(url){ router.push({ uri: url, }) }, /** * @description: 连接到wifi * @param {*} * @return {*} */ connectWifi(){ const params = { ssid: "Smart-HK", password: "hktest2020" } this.$app.$def.bridge.connectWifi(params) .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, /** * @description: 获取wifi信息 * @param {*} * @return {*} */ getWifiInfo(){ this.$app.$def.bridge.getWifiInfo() .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, testBridge(name){ switch(name){ case 'connectWifi': this.connectWifi() break; case 'getWifiInfo': this.getWifiInfo() break; default: break; } } }