directives.ts 661 B

123456789101112131415161718192021222324
  1. import { App } from 'vue';
  2. import { permission } from '@/directives/permission';
  3. import copy from '@/directives/copy';
  4. import debounce from '@/directives/debounce';
  5. import throttle from '@/directives/throttle';
  6. import draggable from '@/directives/draggable';
  7. /**
  8. * 注册全局自定义指令
  9. * @param app
  10. */
  11. export function setupDirectives(app: App) {
  12. // 权限控制指令(演示)
  13. app.directive('permission', permission);
  14. // 复制指令
  15. app.directive('copy', copy);
  16. // 防抖指令
  17. app.directive('debounce', debounce);
  18. // 节流指令
  19. app.directive('throttle', throttle);
  20. // 拖拽指令
  21. app.directive('draggable', draggable);
  22. }