thelounge/client/components/Username.vue

40 lines
730 B
Vue
Raw Normal View History

<template>
<span
:class="['user', nickColor, {active: active}]"
:data-name="user.nick"
role="button"
2019-07-17 09:33:59 +00:00
v-on="onHover ? {mouseover: hover} : {}"
2019-11-09 22:21:34 +00:00
@contextmenu.prevent="rightClick($event)"
2019-07-17 09:33:59 +00:00
>{{ user.mode }}{{ user.nick }}</span
>
</template>
<script>
const colorClass = require("../js/helpers/colorClass");
export default {
name: "Username",
props: {
user: Object,
active: Boolean,
2018-07-10 23:25:21 +00:00
onHover: Function,
2019-11-09 22:21:34 +00:00
contextMenuCallback: Function,
2018-07-10 23:25:21 +00:00
},
computed: {
nickColor() {
return colorClass(this.user.nick);
},
},
2018-07-10 23:25:21 +00:00
methods: {
hover() {
return this.onHover(this.user);
2018-07-10 23:25:21 +00:00
},
2019-11-09 22:21:34 +00:00
rightClick($event) {
if (this.contextMenuCallback) {
this.contextMenuCallback($event, this.user);
}
},
},
};
</script>