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

@wangyuanlin/vue-common-plugin

v1.0.0

Published

Common Vue utilities and directives plugin for Vue 2 and Vue 3.

Readme

@linking/vue-common-plugin

一个开箱即用的 Vue 常用插件,兼容 Vue 2.7+ 与 Vue 3。

Features

  • 全局工具 API($lc
    • copyText
    • debounce
    • throttle
    • formatDate
    • storagelocal/session
    • hasPermission / setPermissions / getPermissions
  • 常用指令
    • v-lc-focus 自动聚焦
    • v-lc-lazy 图片/背景图懒加载
    • v-lc-permission 权限显隐
  • 支持 Vue2 / Vue3(基于 vue-demi

Install

npm i @linking/vue-common-plugin

Vue 2 项目如果 vue-demi 未自动切换成功,可执行:

npx vue-demi-switch 2

Usage

Vue 3

import { createApp } from 'vue';
import App from './App.vue';
import LinCommonPlugin from '@linking/vue-common-plugin';

const app = createApp(App);
app.use(LinCommonPlugin);
app.mount('#app');

Vue 2

import Vue from 'vue';
import App from './App.vue';
import LinCommonPlugin from '@linking/vue-common-plugin';

Vue.use(LinCommonPlugin);

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

API

安装后可通过 this.$lc 使用:

this.$lc.copyText('hello world');
this.$lc.formatDate(Date.now(), 'YYYY-MM-DD');
this.$lc.hasPermission(['admin', 'ops']);

setup 里可用:

import { useLinCommon } from '@linking/vue-common-plugin';

const lc = useLinCommon();

Directives

v-lc-focus

<input v-lc-focus />
<input v-lc-focus="{ preventScroll: true }" />

v-lc-lazy

<img
  v-lc-lazy="{
    src: detail.cover,
    loading: '/images/loading.svg',
    error: '/images/error.png'
  }"
/>

v-lc-permission

<button v-lc-permission="'admin'">仅管理员可见</button>
<button v-lc-permission="['admin', 'editor']">管理员和编辑可见</button>

Custom Options

import { createLinCommonPlugin } from '@linking/vue-common-plugin';

app.use(
  createLinCommonPlugin({
    namespace: '$toolkit',
    directivePrefix: 'lin',
    permissions: ['admin', 'editor'],
    permissionMode: 'hide', // hide | remove
    permissionMatchMode: 'all', // all | any
    allowWhenNoPermissionData: false,
    lazy: {
      rootMargin: '0px 0px 120px 0px',
      threshold: 0.1,
      loading: '/loading.svg',
      error: '/error.png',
      once: true
    }
  })
);

Build

npm run typecheck
npm run test
npm run build