npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zkty-team/x-engine-module-router

v0.1.20

Published

统一所有的跳转, router 与 nav 在路由名称上有所混淆. nav 只用在微应用内部, router 是用于全局路由. 包含了 nav 的功能.

Downloads

1

Readme

统一所有的跳转, router 与 nav 在路由名称上有所混淆. nav 只用在微应用内部, router 是用于全局路由. 包含了 nav 的功能.

但 router 一定会创建新实例. 如果只在某微应用内部路由.应该只使用nav.一来性能好,二来你能拥有一个统一的状态管理器. 比如 vue 里的 vuex. react 里的 redux.

规则
  • 跳 h5
    • https://..
    • http://..
  • 跳微应用
    • appid + 路径 + 参数
  • 跳 uniapp
    • appid + 路径 + 参数
  • 微信小程序
    • userName + 路径 + 参数
  • 跳原生界面
    • iOS
      • 类名 + 参数
    • android
      • 类名 + 参数

image-20201010170737644

参数:

{
  type: string (native | h5 | microapp | uni | wx ),  // string 类型 maxlength(16)
  uri:  string (url | microappid | wx_username | 'XViewController,com.zkty.view.XActivity'), // 资源名 maxlength(1024)
  fallback: string,         //(url链接),maxlength(1024)
  path: string,             // 路径 /abc  /abc?a=1  maxlength(4096) 注意:参数在这传递!
 	version: int,             // 如果是 microapp, version 代表版本号,
	hideNavbar: boolean,      // 路由目标页是否显示 navbar,默认是 false
 args: map                 // 保留字段, 
}

args 形如:

{
	"something":"",
	...
}

比如金刚区:

[
 {
   "type": "microapp",
   "uri": "com.zkty.microapp.propertylist",
   "path": "/", 
   "fallback": "http//:www.baidu.com",
   "version":0,
   "args": {}
 },
 {
   "type": "h5",
   "uri": "https://www.baidu.com",
   "fallback": "http//:www.baidu.com",
   "path": "/"
 },
 {
   "type": "uni",
   "uri": "__UNI__86C4327",
   "fallback": "http//:www.baidu.com",
   "path": "/"
 },
 {
   "type":"native",
   "url":"ZKLocalWebViewController,cn.timesneighborhood.app.c.view.activity.OpenGatesActivity",
   "fallback": "http//:www.baidu.com",   
 },
 {
   "type":"wx",
   "uri":"wx_dfsnosj28123",
   "path":"/home",
   "fallback": "http//:www.baidu.com"
 }
]

| | h5 | microApp | wx | native | uni | | ----------- | ------ | -------- | ------ | ------ | ------ | | h5 跳 | 无意义 | 支持 | 支持 | 支持 | 支持 | | microApp 跳 | 支持 | 无意义 | 支持 | 支持 | 支持 | | wx 跳 | - | - | 无意义 | - | - | | native 跳 | 支持 | 支持 | 支持 | 无意义 | 支持 | | uni 跳 | 支持 | 支持 | 支持 | 支持 | 无意义 |

h5通过 scheme 的方式

x-engine-call://{moduleId}/{method}?args={xxx}&callback={callbackurl}

window.open(`x-engine-call://${moduleId}/${method}/args=${encodeURIComponent({...})&callback=encodeURIComponent("https://xxx.com/indexhtml?ret={ret}")}`)

xxx 为 urlencode 过的 json String (使用 encodeURIComponent) {callbackurl} 由调用者指定(必须urlencode), 如https://baidu.com?ret={ret}

{ret} 将被替换为返回值. {ret} 为 urlencode 过的 json String

在拿到返回值后, 在当前页面打开 {callbackurl}

uni 通过 api 方式

event:x-engine-wgt-call

{ "moduleId":"moduleId", "method":{method}, "args":{args}, }

返回值, 统一转成 json string.

将弃用

event:x-engine-wgt-event

{ "moduleName":"moduleName", "method":{method}, "args":{args}, }

返回值, 统一转成 json string.

跳微信小程序需知

跳转规则

  1. 对于已通过认证的开放平台账号,其移动应用可以跳转至任何合法的小程序,且不限制跳转的小程序数量。
  2. 对于未通过认证的开放平台账号,其移动应用仅可以跳转至同一开放平台账号下小程序。

注意:若移动应用未上架,则最多只能跳转小程序100次/天,用于满足调试需求。

外部需求:

参看: opensdk 接入指南