代码如下:

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
                                            }
                                        }
                                });

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐