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

vue-common-directive

v0.1.1

Published

vue vue-directive directive

Downloads

40

Readme

下载依赖

npm i vue-common-directive

批量注册指令

import Vue from 'vue'

import * as directives from 'vue-common-directive'

Object.keys(directives).forEach((key) => {
  Vue.directive(key, directives[key])
})

单独引用

js:
import { copy } from 'vue-common-directive'
vue.directive('copy', copy)

html:
<button v-copy="copyText">复制</button>

directive list

  • backtop 返回顶部

    参数 id: 给需要回到顶部的元素添加的id 可选 offset: 偏移距离为 height 时显示指令绑定的元素 可选

    <div  v-backtop:app="400"> 回到顶部 </div>
    <div  v-backtop> 回到顶部 </div>
  • clickOut 判断为点击到元素外

  • ellipsis 文字超出省略 参数:width

    <div v-ellipsis:100> 需要省略的文字需要省略的文字需要省略的文字需要省略的文字</div>
  • resize 应元素宽高改变时执行的方法

 <div v-resize="resize"></div>
  • scrollPop 元素展示时 固定html滚动 只有当前弹窗可滚动
  • throttle 函数节流指令
<button v-throttle="{fn: throttle,time:3000}">throttle节流</button>
  • copy 复制文本 参数:需要复制的文本变量
  • longpress 长按2s 参数:长按两秒执行的函数
  • debounce 防抖1s 参数:Function
  • LazyLoad 延迟加载 参数:图片的src地址
  • waterMarker 水印 v-waterMarker="{text:'测试',textColor:'rgba(180, 180, 180, 0.5), font: ''}"
  • draggable 可视区域拖拽