2
0
mirror of https://github.com/frappe/books.git synced 2025-01-27 09:08:24 +00:00
books/src/components/MouseFollower.vue
18alantom 7c202ecee8 chore: fix --fix able vue eslint issues
- type in workflow
2023-06-23 12:35:44 +05:30

36 lines
786 B
Vue

<template>
<Tooltip ref="tooltip"><slot></slot></Tooltip>
</template>
<script>
import { defineComponent } from 'vue';
import Tooltip from './Tooltip.vue';
export default defineComponent({
components: { Tooltip },
props: { show: { type: Boolean, default: false } },
watch: {
show(val) {
if (val) {
this.$refs.tooltip.create();
this.setListeners();
} else {
this.$refs.tooltip.destroy();
this.removeListener();
}
},
},
methods: {
mousemoveListener(e) {
this.$refs.tooltip.update(e);
},
setListeners() {
window.addEventListener('mousemove', this.mousemoveListener);
},
removeListener() {
window.removeEventListener('mousemove', this.mousemoveListener);
},
},
});
</script>