生命周期函数
/**
*
* 页面渲染完成,可进行交互
* 若不关闭,则只调用一次
*/
onReady() {
console.log(" onReady");
let __this = this;
},
/***
*
uni.redirectTo({
url: 'scan',
success: (e) => {}
})
uni.switchTab({
url:'index',
success:(e)=>{
}
})
或者navigateBack(即按返回键)
*/
onUnload() {
console.log('onUnload')
},
/**
*
* 页面开始加载,接收参数传递
*/
onLoad() {
var __this = this
},
/**
*
* 页面切入,包括小程序切入后台返回时
*/
onShow () {
console.log('onShow=>');
},
/***
*
uni.navigateTo({
url: 'scan',
success: (e) => {}
})
或者底部 tab 切换到其他页面,
小程序切入后台(手机灭屏,点击手机的任务栏功能键,切换至微信或其他APP)等
*/
onHide () {
console.log('onHide=>');
},