代码如下:
uni.showModal({
title: '提示:',
content: '请确认是否要退出登录?',
success: function(res) {
if (res.confirm) {
console.log('确定');
setTimeout(function() {
uni.reLaunch({
url: '/pages/index/index' // 指定跳转到首页的路由路径
});
}, 500);
} else if (res.cancel) {
// console.log('取消');
//TODO
return
}
}
});