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

header-lynn2025

v1.0.1

Published

header-lynn

Readme

My Vue Components

基于 Vue2 和 Element UI 的组件库,支持通过 npm 安装或 CDN 直接引入使用。

安装

方式一:npm 安装

npm install my-vue-components

方式二:CDN 引入(推荐)

通过 jsDelivr 或 unpkg CDN 使用:

<!-- 引入 Vue2 -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>

<!-- 引入 Element UI CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入 Element UI JS -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

<!-- 引入组件库 -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/my-components.js"></script>

或者使用 unpkg:

<script src="https://unpkg.com/[email protected]/dist/my-components.js"></script>

使用

通过 CDN 使用

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>使用 CDN 组件</title>
  
  <!-- 引入依赖 -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  
  <!-- 引入组件库 -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/my-components.js"></script>
</head>
<body>
  <div id="app">
    <!-- 组件会自动注册,可以直接使用 -->
    <!-- <my-button>按钮</my-button> -->
  </div>

  <script>
    new Vue({
      el: '#app',
      // 组件已自动注册,无需手动调用 Vue.use()
    });
  </script>
</body>
</html>

通过 npm 使用

import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import MyComponents from 'my-vue-components';

Vue.use(ElementUI);
Vue.use(MyComponents);

new Vue({
  render: h => h(App)
}).$mount('#app');

开发

本地开发

# 安装依赖
npm install

# 开发模式(监听文件变化)
npm run dev

# 构建生产版本
npm run build

发布到 npm

  1. 确保已登录 npm:npm login
  2. 更新版本号(如需要):修改 package.json 中的 version
  3. 构建:npm run build
  4. 发布:npm publish

发布后,可通过以下 CDN 地址访问:

  • jsDelivr: https://cdn.jsdelivr.net/npm/my-vue-components@版本/dist/my-components.js
  • unpkg: https://unpkg.com/my-vue-components@版本/dist/my-components.js

添加组件

  1. src/components/ 目录下创建组件文件(如 MyButton.vue
  2. src/index.js 中导入并注册组件:
import MyButton from './components/MyButton.vue';

const components = {
  MyButton
};
  1. 重新构建:npm run build

注意事项

  • Vue 和 Element UI 作为外部依赖,不会被打包进组件库
  • 使用 CDN 方式时,需要先引入 Vue 和 Element UI
  • 组件库使用 UMD 格式,支持多种模块系统
  • 通过 script 标签引入时,组件会自动注册到全局 Vue 实例

版本

当前版本:1.0.0

许可证

MIT