add shared profile and messages data
This commit is contained in:
parent
56196bcbcf
commit
2c510765c0
12 changed files with 109 additions and 107 deletions
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- message context -->
|
||||
<span class="context">
|
||||
<div :class="`${type}-icon`">
|
||||
<div :class="`${type}-icon`"/>
|
||||
{{ context }}
|
||||
</span>
|
||||
|
||||
|
|
@ -22,23 +22,24 @@
|
|||
import { defineComponent, ref, onMounted } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: "MessageItem",
|
||||
name: "Bubble",
|
||||
|
||||
props: ["text", "context", "type", "position"],
|
||||
|
||||
setup() {
|
||||
|
||||
const seen = ref(false);
|
||||
/* initialize seen state */
|
||||
const seen = ref(() => {
|
||||
if (document.visibilityState === "visible") {
|
||||
return true;
|
||||
} else return false;
|
||||
});
|
||||
if (document.visibilityState === "visible") {
|
||||
seen.value = true;
|
||||
} else seen.value = false;
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
if (!seen)
|
||||
document.addEventListener("visibilitychange", () => seen = true);
|
||||
if(seen.value)
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
seen.value = true
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue