41 lines
666 B
Vue
41 lines
666 B
Vue
<script>
|
|
export default {
|
|
methods:{
|
|
networkStatusChange(res){
|
|
if(res.isConnected){
|
|
uni.redirectTo({
|
|
url:'/pages/index/index'
|
|
})
|
|
}else{
|
|
uni.redirectTo({
|
|
url:'/pages/networko/index'
|
|
})
|
|
}
|
|
|
|
}
|
|
},
|
|
onLaunch: function() {
|
|
},
|
|
onShow: function() {
|
|
uni.getNetworkType({
|
|
success:(res)=> {
|
|
if(res.networkType==='none') {
|
|
uni.redirectTo({
|
|
url: '/pages/networko/index'
|
|
})
|
|
|
|
}
|
|
}
|
|
})
|
|
uni.onNetworkStatusChange(this.networkStatusChange);
|
|
},
|
|
onHide: function() {
|
|
uni.offNetworkStatusChange(this.networkStatusChange)
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
/*每个页面公共css */
|
|
</style>
|