1.1.3 • Published 3 years ago

dndc-medusa-wx-router v1.1.3

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 years ago

medusa-wx-router

基于微信小程序路由功能 API 进行的二次封装函数,提供以同一 API 使用原生四种跳转能力的功能以及参数保真功能。

API 说明

routerTo

通用跳转函数,提供跳转与参数保真功能

参数

属性类型默认值必填说明
urlString-目标页面路径
typeStringpush跳转方式
queryObject-跳转参数
successFunction-跳转成功回调函数

示例

import mc from 'medusa-wx-router';
/** 完整调用方式 */
mc.routerTo({
  url: 'pages/home/index',
  type: 'push',
  query: {
    id: 0,
    bool: true
  },
  success: () => console.log('successfully'),
});
/** navigateTo API快捷形式 */
mc.routerTo('pages/home/index', {
  id: 0,
  bool: true
});

type 映射关系

typeAPI
pushnavigateTo
replaceredirectTo
reLaunchreLaunch
switchTabswitchTab

back

提供回退功能

参数

属性类型默认值必填说明
deltaNumber1回退步值

示例

mc.back(delta);

goHome

返回首页功能

示例

mc.goHome();

License

MIT

1.1.3

3 years ago