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

cthep-ui-vue2

v0.4.78

Published

爱习题组件库v2

Readme

cthep-ui-vue2 插件使用说明

Vant2 样式隔离方案

本插件内置了 Vant2 组件库,为了避免与接入方使用的 Vant3 样式冲突,采用了 CSS 命名空间隔离方案。

构建步骤

在发布npm包之前,需要先生成带命名空间的 Vant 样式文件:

cd package
# 安装依赖
npm install

# 生成带命名空间的 vant 样式
node build-vant-style.js

执行成功后会在 package 目录下生成 vant-scoped.css 文件。

工作原理

  1. 样式隔离: 通过 PostCSS 为所有 Vant2 样式添加 .cthep-ui-v2 前缀
  2. 组件包裹: 所有使用 Vant 组件的地方都需要用 <div class="cthep-ui-v2"> 包裹
  3. 样式加载: 插件会自动引入带命名空间的 Vant 样式

使用示例

<template>
  <div class="cthep-ui-v2">
    <!-- 你的组件内容 -->
    <van-button type="primary">按钮</van-button>
    <van-popup v-model="show">弹窗内容</van-popup>
  </div>
</template>

<script>
export default {
  name: 'YourComponent',
  data() {
    return {
      show: false
    }
  }
}
</script>

发布流程

  1. 修改组件代码
  2. 运行 node build-vant-style.js 生成样式文件
  3. 确保 vant-scoped.css 文件存在
  4. 发布到 npm:npm publish

注意事项

⚠️ 重要:

  • 所有使用 Vant 组件的 Vue 文件都必须在最外层添加 <div class="cthep-ui-v2"> 包裹
  • 每次修改后发布前都要重新运行 build-vant-style.js
  • 不要手动修改 vant-scoped.css 文件,该文件是自动生成的

接入方使用

接入方无需任何额外配置,只需正常安装和使用:

import Vue from 'vue'
import cthepUIVue2 from 'cthep-ui-vue2'

Vue.use(cthepUIVue2)

即使接入方同时使用了 Vant3,也不会产生样式冲突。