百度智能小程序 关闭所有页面

2020-09-05 14:07 更新

swan.reLaunch

解释:关闭所有页面,打开到应用内的某个页面。

方法参数

Object object

object参数说明

属性名 类型 必填 默认值 说明 Web 态说明

url

String

需要跳转的应用内页面路径 , 路径后可以带参数。参数与路径之间使用 ? 分隔,参数键与参数值用=相连,不同参数用 & 分隔;如 ‘path?key=value&key2=value2’,如果跳转的页面路径是 tabBar 页面则不能带参数。

success

Function

接口调用成功的回调函数

不支持

fail

Function

接口调用失败的回调函数

不支持

complete

Function

接口调用结束的回调函数(调用成功、失败都会执行)

不支持

示例

代码示例 

在开发者工具中打开

<view class="wrap">
    <view>这是api tab页面</view>
    <button bind:tap="reLaunch" type="primary" hover-stop-propagation="true">跳转到detail页</button> 
</view>
Page({
    reLaunch(e) {
        swan.reLaunch({
            url: '/detail/detail/key=value',
            success: res => {
                console.log('reLaunch success');
            },
            fail: err => {
                console.log('reLaunch fail', err);
            }
        });
    }
});


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号