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

vuejs-directive

v0.0.361

Published

> 记录vue自定义指令

Downloads

13

Readme

vuejs-directive

记录vue自定义指令

Initial

npm install vuejs-directive

方法

| 指令 | 说明 | 备注 | |---|---|---| | debounce | 函数防抖 | 防抖时间默认为500ms| | ellipsis | 文本省略 | 行数默认为1 | | sizeOb | 监听元素大小 | 返回宽高 | | writing | canvas画布 | 使用函数可返回base64与File,line-width改变笔画宽度默认为3、line-color改变笔画色彩默认为#000000 | | largeScreen | 元素自适应 |默认1920 * 1080 | | dragPoint | 拖拽指令 | 返回left与top值 |

使用方法
// main.ts中
// 全局
const app = createApp(App);
import directivejs from 'vuejs-directive';
app.use(directivejs)

// 单个
import {directives} from 'vuejs-directive'
app.directive('string',directives.debounce)
// 局部使用
<template>
<div v-size-ob="size" class="box"></div>
</template>

// <script lang='ts' setup>
// import  {directives} from 'vuejs-directive'
// const vSizeOb = directives.sizeOb
// const size = (e)=> {
//     console.log(e);
// }
// </script>

// <script lang="ts">
// import { directives } from 'vuejs-directive';
// export default {
// 	directives: {
// 		sizeOb: directives.sizeOb,
// 	},
// 	methods: {
// 		size(el: any) {
// 			console.log(el);
// 		},
// 	},
// };
// </script>
函数防抖
<div v-debounce="click"/>
<div v-debounce:[1]="click" debounce-time="1000"/>
// 可使用属性debounce-time更改,可通过[1]传递一个参数
const = click(Event,1):void
文本省略
<span v-ellipsis="2">测试</span>
元素大小监听
<div v-size-ob="api">测试测试</div>
canvas画布
<canvas line-width="3" line-color="red" v-writing="api"></canvas>
const = api(object,Fn)=>{
    // 返回base64与File
    第二参数为回调函数,可用于重置画布
}
大屏自适应
<div v-large-screen ></div>
<div v-large-screen width="1920" height="1080"></div>
拖拽指令
<div v-dragPoint></div>