vue-directives-lib
🚀实用的vue自定义指令
**中文** | [English](./README.md)
- [预览地址](https://vue-directives-lib.vercel.app/)
## 📦 安装
```bash
npm install vue-directives-lib
or
pnpm add vue-directives-lib
or
yarn add vue-directives-lib
```
## 🦄 用法
- 全局引入
```ts
// main.ts
import { createApp } from "vue";
import App from "./App.vue";
import vueDirectives from "vue-directives-lib";
const app = createApp(App);
app.use(vueDirectives);
app.mount("#app");
```
- 局部引入
```ts
// test.vue
{{ copyValue }}
```
## 🐳 功能列表
| 指令名 | 说明 | 参数 | 备注 |
| -------------- | --------------------------------------------------------------- | ----------------------------| --------------------- |
| `v-copy` | Copy text content | {copyValue,callback} | v-copy="'复制的内容'" |
| `v-tooltip` | When the text overflows, display all content around the element | {offset:10} | v-tooltip={offset:10} |
| `v-longpress` | longpress func | {callback:()=>{}} | v-longpress |
| `v-hidden` | to hide the element | -- | v-hidden="true" |
| `v-typed` | typed text | {value: string, loop: true} | v-typed="text" |
| `v-ellipsis` | ellipsis text | {rows: 1,content: string} | v-ellipsis="1" |