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

vite-uni-route

v0.0.5

Published

在Vite构建的Vue应用中,编译阶段扫描pages.json,更新pages.json,添加路由name、路由type,useRouter在插件运行的时候

Downloads

9

Readme

vite-uni-route

vite-uni-route 是一个专为 UNIAPP 设计的 Vite 插件,为 Vue 3 + Vite 构建的项目提供支持。它允许在编译阶段,对pages.json进行扫描,并且生成相应的name标识。搭配utils中useRouter()方法,即可实现路由跳转。

安装

要在您的项目中安装 vite-uni-route 插件,可以使用以下命令:

pnpm install vite-uni-route

或者,如果您使用 npm:

npm install vite-uni-route

或者,如果您使用 yarn

yarn install vite-uni-route

使用方法

  • uni()方法之前引入
  • 无需其他配置
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import {uniRouteImport} from 'vite-uni-route';

export default defineConfig(() => {
  return {
    plugins: [uniRouteImport(), uni()],
  };
});

useRouter 参数配置

  • useRouter 入参支持路由name:string以及object
  • 并且支持ts提示

string

  • 类型: Path
  • 默认值: undefined
  • Path类型为插件运行时自动生成,并且这useRouter方法中自动引入

object

  • 类型: RouterParams

| 参数名 | 类型 | 描述 | 默认值 | 是否可选 | | ------ | ----------------------------- | ------------------------------------------------------------------------------------------------------------- | ----------- | -------- | | path | Path | 单页面路由文件名。自动生成 | | 必选 | | params | Record<string, any> | 路由传递的参数对象。 | undefined | 可选 | | close | 'default' 'current' 'all' | 'default': 不关闭任何页面直接跳转。'current': 关闭当前页后跳转。'all': 关闭所有页面后跳转。 | default | 可选 |