index.js 612 B

1234567891011121314151617181920212223
  1. // 埋点插件
  2. import { showReportDialog } from '@sentry/vue';
  3. import clickLog from './click';
  4. import ShowLogObserver from './show';
  5. const AutoLog = {};
  6. AutoLog.install = (app) => {
  7. app.directive('click-log', clickLog);
  8. app.directive('show-log', {
  9. mounted(el, binding) {
  10. // 加载阶段设置随机key标记当前元素
  11. el.denetShowLogkey = el.denetShowLogkey || Math.random().toString(36).slice(-6);
  12. ShowLogObserver.add(el, binding);
  13. },
  14. unmounted(el) {
  15. ShowLogObserver.remove(el);
  16. },
  17. });
  18. }
  19. export default AutoLog;