hardlounge/client/components/UsernameFiltered.vue
2019-11-25 20:13:12 +02:00

40 lines
758 B
Vue

<template>
<span
:class="['user', nickColor, {active: active}]"
:data-name="user.original.nick"
role="button"
@mouseover="hover"
@contextmenu.prevent="rightClick($event)"
v-html="user.original.mode + user.string"
/>
</template>
<script>
import colorClass from "../js/helpers/colorClass";
export default {
name: "UsernameFiltered",
props: {
user: Object,
active: Boolean,
onHover: Function,
contextMenuCallback: Function,
},
computed: {
nickColor() {
return colorClass(this.user.original.nick);
},
},
methods: {
hover() {
this.onHover ? this.onHover(this.user.original) : null;
},
rightClick($event) {
if (this.contextMenuCallback) {
this.contextMenuCallback($event, this.user);
}
},
},
};
</script>