1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-18 00:29:10 +09:00
This commit is contained in:
syuilo 2020-02-20 06:38:19 +09:00
parent b8e155ab40
commit ff3a97f6cf
2 changed files with 11 additions and 7 deletions

View File

@ -53,6 +53,7 @@ export default Vue.extend({
return { return {
u: null, u: null,
show: false, show: false,
closed: false,
top: 0, top: 0,
left: 0, left: 0,
}; };
@ -68,6 +69,7 @@ export default Vue.extend({
{ userId: this.user }; { userId: this.user };
this.$root.api('users/show', query).then(user => { this.$root.api('users/show', query).then(user => {
if (this.closed) return;
this.u = user; this.u = user;
this.show = true; this.show = true;
}); });
@ -83,6 +85,7 @@ export default Vue.extend({
methods: { methods: {
close() { close() {
this.closed = true;
this.show = false; this.show = false;
if (this.$refs.content) (this.$refs.content as any).style.pointerEvents = 'none'; if (this.$refs.content) (this.$refs.content as any).style.pointerEvents = 'none';
} }

View File

@ -39,11 +39,15 @@ export default {
self.hideTimer = setTimeout(self.close, 500); self.hideTimer = setTimeout(self.close, 500);
}); });
self.checkTimer = setInterval(() => {
if (!document.body.contains(el)) self.close();
}, 1000);
document.body.appendChild(self.tag.$el); document.body.appendChild(self.tag.$el);
self.checkTimer = setInterval(() => {
if (!document.body.contains(el)) {
clearTimeout(self.showTimer);
clearTimeout(self.hideTimer);
self.close();
}
}, 1000);
}; };
el.addEventListener('mouseover', () => { el.addEventListener('mouseover', () => {
@ -66,9 +70,6 @@ export default {
unbind(el, binding, vn) { unbind(el, binding, vn) {
const self = el._userPreviewDirective_; const self = el._userPreviewDirective_;
clearTimeout(self.showTimer);
clearTimeout(self.hideTimer);
clearInterval(self.checkTimer); clearInterval(self.checkTimer);
self.close();
} }
}; };