cashier-paid/App.vue

43 lines
1015 B
Vue

<script setup>
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
import { inUpdate } from "@/utils/update.js"
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')
inUpdate()
})
onShow(() => {
console.log('App Show')
isHaveNetwork()
})
onHide(() => {
console.log('App Hide')
})
</script>
<style>
/*每个页面公共css */
</style>