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 🙏

© 2026 – Pkg Stats / Ryan Hefner

xiaowu-vue

v1.3.10

Published

一个快速创建 Vue3 移动端项目的脚手架工具

Readme

xiaowu-vue

一个基于 Vue3 + Vant4 的移动端项目模板,采用最新的技术栈和最佳实践。

特性

  • 📦 技术栈:Vue3 + Vite + Pinia + Vant4
  • 📱 移动端适配:rem 方案 (web 也是保持的 iPhone6 样式)
  • 🚀 自动化
    • 自动路由生成
    • VUE 组件自动导入
    • VUE API自动导入
    • Vant 组件自动导入
  • 封装 request
    • 自动添加 Token:在请求头中自动添加 Authorization。
    • 请求取消:支持自动取消重复请求和手动取消所有请求。
    • 统一错误处理:可选择根据业务状态码(code)或 HTTP (status)状态码统一处理错误。
    • 请求重试:对网络错误或服务器错误(5xx)自动重试。
    • 登录过期处理:当 HTTP 状态码为 401 时,自动跳转到登录页。
    • 自定义配置:支持通过配置禁用错误提示。
  • 🔒 安全性
    • 登录验证
    • 多种加密
    • 路由守卫
    • Token 管理
  • 🛠️ 开发体验
    • 打包分析
    • 开发调试
  • 📦 组件封装
    • NavBar 导航栏
    • Tabbar 标签栏

可选择 js,ts,i18n,eslint,prettier,vitest等(目前模板有登录注册退出登录等功能,还在进一步完善中)

快速开始

安装

# npm
npm install -g xiaowu-vue

# yarn
yarn global add xiaowu-vue

# pnpm
pnpm add -g xiaowu-vue

创建项目

xiaowu-vue my-project
cd my-project
npm install
npm run dev

核心功能

1. 自动路由

路由生成规则

views/
  ├── home/
  │   └── index.vue         -> /home
  ├── auth/
  │   ├── login.vue        -> /auth/login
  │   └── register.vue     -> /auth/register
  └── user/
      └── UserProfile.vue   -> /user/user-profile

路由元信息

{
  hideTabbar: false,  // 是否隐藏底部导航栏
  keepAlive: true,    // 是否启用页面缓存
  title: '页面标题'    // 页面标题
}

2. 请求封装

基础用法

import request from '@/utils/request'

// GET 请求
request.get('/api/users')

// POST 请求
request.post('/api/login', {
  username: 'admin',
  password: '123456'
})

配置选项

request.post('/api/login', data, {
  noToast: true,      // 禁用错误提示
  retry: 3,           // 请求重试次数
  retryDelay: 1000    // 重试间隔
})

3. 加密工具

MD5 加密

import { encrypt, encryptWithSalt } from '@/utils/crypto'

// 基础加密
const hash = encrypt('password')

// 带盐加密
const saltedHash = encryptWithSalt('password', 'secret-key')

Base64 编码

import { base64Encode, base64Decode } from '@/utils/crypto'

// 编码
const encoded = base64Encode('Hello World')

// 解码
const decoded = base64Decode(encoded)

4. 组件使用

NavBar 导航栏

<template>
  <nav-bar 
    title="页面标题"
    :show-back="true"
    background-color="#ffffff"
    @click-right="onClickRight"
  />
</template>

Tabbar 标签栏

<template>
  <van-tabbar v-model="active">
    <van-tabbar-item icon="home-o">首页</van-tabbar-item>
    <van-tabbar-item icon="user-o">我的</van-tabbar-item>
  </van-tabbar>
</template>

项目结构

src/
├── api/                # API 接口
├── assets/            # 静态资源
├── components/        # 公共组件
├── router/           # 路由配置
│   ├── autoRouter.js   # 自动路由
│   └── metaConfig.js   # 路由元信息
├── store/            # 状态管理
├── styles/           # 全局样式
├── utils/            # 工具函数
│   ├── request.js     # 请求封装
│   └── crypto.js      # 加密工具
└── views/            # 页面组件

开发指南

1. 新建页面

  1. views 目录创建 .vue 文件
  2. 路由会自动生成
  3. 可在 metaConfig.js 配置页面属性

2. 状态管理

// store/modules/user.js
export const useUserStore = defineStore('user', {
  state: () => ({
    userInfo: null
  }),
  actions: {
    // ...
  }
})

3. 样式开发

// 使用 rem 函数
.container {
  width: rem(375);
  height: rem(100);
  font-size: rem(14);
}

发布部署

# 构建生产版本
npm run build

# 预览构建结果
npm run preview

注意事项

  1. 移动端适配

    • 设计稿基准宽度:375px
    • 开发时使用 px,自动转换为 rem
  2. 路由配置

    • 自动生成的路由支持嵌套
    • 可通过元信息控制页面行为
  3. 安全性

    • 密码传输使用 MD5 加密
    • 敏感信息不要使用 Base64

更新日志

v1.0.0

  • 初始版本发布
  • 基础框架搭建
  • 核心功能实现

贡献指南

  1. Fork 本仓库
  2. 创建特性分支
  3. 提交代码
  4. 发起 Pull Request

许可证

MIT