41 lines
727 B
Vue
41 lines
727 B
Vue
<template>
|
|
<span
|
|
:class="['user', nickColor, {active: active}]"
|
|
:data-name="user.nick"
|
|
role="button"
|
|
v-on="onHover ? {mouseover: hover} : {}"
|
|
@click.prevent="openContextMenu"
|
|
@contextmenu.prevent="openContextMenu"
|
|
>{{ user.mode }}{{ user.nick }}</span
|
|
>
|
|
</template>
|
|
|
|
<script>
|
|
import colorClass from "../js/helpers/colorClass";
|
|
|
|
export default {
|
|
name: "Username",
|
|
props: {
|
|
user: Object,
|
|
active: Boolean,
|
|
onHover: Function,
|
|
},
|
|
computed: {
|
|
nickColor() {
|
|
return colorClass(this.user.nick);
|
|
},
|
|
},
|
|
methods: {
|
|
hover() {
|
|
return this.onHover(this.user);
|
|
},
|
|
openContextMenu(event) {
|
|
this.$root.$emit("contextmenu:user", {
|
|
event: event,
|
|
user: this.user,
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|