跳转方式

代码如下

<?php 
namespace view\app\layout;
use think\facade\Db;
use think\facade\Request;
// +----------------------------------------------------------------------
// | 模板自定义扩展方法
// | Author @梦雨 QQ50361804
// +----------------------------------------------------------------------
class demo
{
    public $info = array(
        'open'=>1,
        'name'=>'示例页面',//页面描述
        'url'=>'/pages/mi/index?id=demo',//所有的url格式都是/pages/mi/index后面是参数
    );
    // 获取布局数据
    public function layout()
    {
        $data = array(
            'zhuti'=>'#00b0ff',//主题的背景样式不可以是白色背景或者留空
            'title'=>'示例页面',//头部标题
            'style'=>'padding: 20px;',//页面的容器配置
            'dataStyle'=>'',//页面的模块通用配置
            'dataModel'=>array(),
            'data'=>array(
                array(
                    'type'=>'html',//类型
                    'style'=>'',//当前框架的样式
                    'listsStyle'=>'',//是在当前lists的父框架样式但是低于上面的style
                    'lists'=>array(
                        array(
                            'style' =>'',//当前模块的样式
                            'url'=>'/pages/mi/index?id=index',//跳转方式 - 跳转url
                            'type'=>'navigateTo',//跳转方式 - 跳转类型
                            'content' => '<div style="color: red;">我是一个按钮</div>'
                        ),
                    )
                ),
            ),
        );
        return json(array('code' => 1, 'msg' => '加载成功', 'data' => $data, 'scroll'=>0.01));
    }

}  

上方代码中的跳转方式 不管是在APP/小程序/H5需要链接跳转方式才能点击跳转

'url'=>'/pages/mi/index?id=index',//跳转方式 - 跳转url
'type'=>'navigateTo',//跳转方式 - 跳转类型

保留当前页面跳转到某个页面navigateTo

保留当前页面跳转到某个页面

array(
    'url'=>'/pages/mi/index?id=index',
    'type'=>'navigateTo',
    'content' => '<div style="color: red;">点击我</div>'
)

关闭所有页面跳转到某个页面reLaunch

关闭所有页面跳转到某个页面

array(
    'url'=>'/pages/mi/index?id=index',
    'type'=>'reLaunch',
    'content' => '<div style="color: red;">点击我</div>'
)

关闭当前页面reLaunch

关闭当前页面

array(
    'url'=>true,
    'type'=>'navigateBack',
    'content' => '<div style="color: red;">点击我</div>'
)

关闭当前页面去某个页面redirectTo

关闭当前页面去某个页面

array(
    'url'=>'/pages/mi/index?id=index',
    'type'=>'redirectTo',
    'content' => '<div style="color: red;">点击我</div>'
)

保存一张图片到相册【app/小程序】saveImageToPhotosAlbum

保存一张图片到相册【app/小程序】

array(
    'url'=>'http://mifenlei.com/123.jpg',
    'type'=>'saveImageToPhotosAlbum',
    'content' => '<div style="color: red;">点击我</div>'
)

微信小程序跳转【小程序】weixin

微信小程序跳转【小程序】

array(
    'url'=>'wx932550753abd2b0c',
    'type'=>'weixin',
    'content' => '<div style="color: red;">点击我</div>'
)

扫码【app/小程序】saoma

扫码【app/小程序】

array(
    'url'=>false,//自动识别跳转
    'type'=>'saoma',
    'content' => '<div style="color: red;">点击我</div>'
)
//或者
array(
    'url'=>array(
        model=>'biaodan'//渲染到表单显示扫描结果
    ),
    'type'=>'saoma',
    'content' => '<div style="color: red;">点击我</div>'
)

查看图片image

查看图片

array(
    'url'=>'http://mifenlei.com/123.jpg',
    'type'=>'image',
    'content' => '<div style="color: red;">点击我</div>'
)
 

下方弹出提示 【微信小程序最多6个】tips

下方弹出提示 【微信小程序最多6个】

array(
    'url'=>array(
        array(
            'name'=>'你点击我我就会跳转到另一个页面'
            'url'=>'/pages/mi/index?id=index',
            'type'=>'navigateTo',
        ),
        array(
            'name'=>'你点击我看看我会提示'
            'url'=>'你点击了我',
            'type'=>'showToasto',
        ),
    ),
    'type'=>'tips',
    'content' => '<div style="color: red;">点击我</div>'
)
 

中间提示内容1秒showToasto

中间提示内容1秒

array(
    'url'=>'你点击了我',
    'type'=>'showToasto',
)

中间成功提示内容1秒showToastSuccess

中间成功提示内容1秒

array(
    'url'=>'提交成功',
    'type'=>'showToastSuccess',
)

自定义提示图标showToastDiy

自定义提示图标

array(
    'url'=>array(
        'icon'=>'http://mifenlei.com/123.png'//图片地址
        'duration'=>'你点击了我'
    ),
    'type'=>'showToastDiy',
)

滚动到页面的任意位置scroll

滚动到页面的任意位置

array(
    'url'=>'0',//填写0到9999999之间
    'type'=>'scroll',
)

电话tel

电话

array(
    'url'=>'10086',
    'type'=>'tel',
)

请求跳转get

请求跳转【method=add是方法id=index是当前的地址】
请求后会加载当前方法的数据渲染当前页面

array(
    'url'=>'/index.php/api/GetAjax?method=add&id=index',
    'type'=>'get',
)

请求跳转清除某个数值getun

请求跳转清除某个数值

array(
    'url' => array(
        'url' => '/index.php/api/GetAjax?id=index&types=0',
        'id' => 2,//清除数值根据当前的页面来定义
    ),
    'type'=>'getun',
)

设置setStorageSync值

设置setStorageSync值

array(
    'url' => array(
        'key' => 'news_ok',//必须是news开始后边任意英文
        'value' => '我可以是数组任意内容',
        'data'=>array(
            'url'=>'设置成功',跳转方式
            'type'=>'showToasto'//类型
        )
    ),
    'type'=>'setStorageSync',
)
//获取
$post = input();
$post['result']['news_ok']

访问地图ditu

访问地图【微信h5和微信小程序直接调用内置地图】APP和h5需要在HBuilderX配置好接口

array(
    'url' => array(
        'lat' => '106.222',//纬度
        'lng' => '22.251',//经度
        'name'=>'地址名称',
        'address'=>'详细地址',
    ),
    'type'=>'ditu',
)
 

退出登陆tuichu

退出登陆

array(
    'url' =>'/pages/mi/index?id=login',//可以跳转到其他地址这里默认登陆页面
    'type'=>'tuichu',
)
 

复制内容copy

复制内容

array(
    'url' =>'内容已复制',
    'type'=>'copy',
)
 

表单提交getAdd

表单提交和get类似

array(
    'url'=>'/index.php/api/GetAjax?method=add&id=index',
    'type'=>'getAdd',
)
 

用浏览器跳转到网站【app】location

用浏览器跳转到网站【app】

array(
    'url'=>'https://www.mifenlei.com/',
    'type'=>'location',
)

内置浏览器打开网页url

内置浏览器打开网页

array(
    'url'=>'https://www.mifenlei.com/',
    'type'=>'url',
)

删除内容实时效果un

删除内容实时效果

array(
    'url'=>'/index.php/api/GetAjax?method=add&id=index',
    'type'=>'un',
)

指定删除某个ID实时效果unid

指定删除某个ID实时效果

array(
    'url'=>'/index.php/api/GetAjax?method=add&id=index',
    'type'=>'unid',
)
目录
设置
主题设置
深色模式
字体设置
字体大小
16