cashier-paid/App.vue

43 lines
1015 B
Vue
Raw Normal View History

2024-05-15 18:34:11 +08:00
<script setup>
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
2024-05-18 18:15:57 +08:00
import { inUpdate } from "@/utils/update.js"
2024-05-15 18:34:11 +08:00
const isHaveNetwork = ()=> {
uni.getNetworkType({
success: res => {
if (res.networkType == 'none') {
uni.showModal({
title: '网络不给力~',
content: '是否重新连接',
showCancel: true,
confirmText: '是',
cancelText: '不了',
success: res => {
if (res.confirm) {
setTimeout(() => {
isHaveNetwork() //再次判断
}, 200)
}
}
});
}
},
fail: err => console.error('调用失败'),
complete: () => {}
})
}
onLaunch(() => {
console.log('App Launch')
2024-05-18 18:15:57 +08:00
inUpdate()
2024-05-15 18:34:11 +08:00
})
onShow(() => {
console.log('App Show')
isHaveNetwork()
})
onHide(() => {
console.log('App Hide')
})
2024-05-09 09:48:05 +08:00
</script>
<style>
2024-05-15 18:34:11 +08:00
/*每个页面公共css */
</style>