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

@jerryc/wxapp-router

v0.0.76

Published

🛵 The router for Wechat Miniprogram

Downloads

78

Readme

WxApp Router

CircleCI Coveralls github branch NPM Version NPM Downloads npm bundle size

动机

对于微信小程序原生路由:

  1. 写代码,要显式判断情况,然后使用不同的 wx.xxx
  2. 暴露真实路由,通过小程序二维码等方式暴露出去的路径,不利于修改项目结构。
  3. 微信路由十层级路由问题、页面死循环问题。
  4. 小程序无限二维码解决方案。(短链参数解析)

介绍

  1. 虚拟路由,解决小程序对外暴露真实路径的问题。
  2. 动态路由参数。
  3. 智能跳转,解决小程序页面栈十层限制问题,与解决小程序页面死循环问题

下载

npm install @jerryc/wxapp-router

使用说明

快速使用

import { Router } from '@jerryc/wxapp-router';

// 创建路由实例
const router = new Router();

// 注册路由
router.register({
  route: '/pages/user/index', // 真实路由
  path: '/user/:id', // 虚拟路由
});

const query = { name: 'jc', age: 18 };

// 智能跳转
router.gotoPage('/user/123', query);
// 跳转到 /pages/user/index
// onLoad(options) 中 options = {name: 'jc', age: 18, id: '123'};

// 显式跳转
router.redirectTo('/user/:123', query);
router.navigateTo('/user/:123', query);
router.navigateBack('/user/:123', query);
router.switchTab('/user/:123', query);

智能跳转策略

动态路由参数

外部路由策略:虚拟路由 & 落地中转策略

内部路由策略:体验更加的调用方式

使用自定义组件跳转

TypeScript 支持

如何组织项目

导航器 Navigator

通过替换跳转引擎,以支持 TaroJS

架构设计

API

详见官网:wxapp-router

License

This project is licensed under the MIT license.
Copyright (c) JerryC Huang ([email protected])