vue3 自定义指令合集插件

440 阅读1分钟

v3-directives 收集了一些常用的vue3自定义指令,然后发布到npm了

地址github.com/QishuangWan…

使用方法

  1. 安装依赖
npm install v3-directives --save
  1. 注册指令
import VueDirectives from "v3-directives";
Vue.use(VueDirectives);

基于 vue 的自定义指令集合,包含

  • 复制粘贴指令 v-copy
  • 图片出错时可使用默认图片 v-RealImg
  • 长按指令 v-longpress
  • 防抖指令 v-debounce
  • 禁止表情及特殊字符 v-emoji
  • 限制输入框类型,可传正则 v-input:type
  • 图片懒加载 v-LazyLoad
  • 权限校验指令 v-premission
  • 实现页面水印 v-waterMarker
  • 拖拽指令 v-draggable
  • 文字超出宽度隐藏 v-ellipsis
  • 拖拽指令 v-hide-text

欢迎提建议,用的顺手给个star吧