New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@microprogram/router

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microprogram/router

[docs](https://jserwang.github.io/microprogram-router/)

latest
Source
npmnpm
Version
1.0.0-beta.10
Version published
Maintainers
1
Created
Source

microprogram-router

docs

Usage

yarn add @microprogram/router
# npm
npm install @microprogram/router

Create router directory in the project, and create an index.js or index.ts file in the router directory

import { 
  createRouter,
  createWechatHistory,
  RouteRecord
} from '@microprogram/router'

const routes: RouteRecord[] = [
  {
    path: '/',
    page: 'pages/index/index'
  },
  {
    path: '/log',
    page: 'pages/log/index'
  }
]

const router = createRouter({
  history: createWechatHistory(),
  routes
})

export default router

in app.ts

import router from './router/index'

App({
  router
})

in anywhere to use

import { useRoute, useRouter } from '@microprogram/router'

Page({
  onShow() {
    // 获取当前页面中的参数
    useRoute().params
  },
  handleClick() {
    useRouter().push('/log')
  }
})

Development

git clone https://github.com/JserWang/microprogram-router
cd microprogram-router
yarn
yarn build

FAQs

Package last updated on 12 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts