hardlounge/client/components/UsernameFiltered.vue

40 lines
758 B
Vue
Raw Normal View History

2018-07-08 15:02:36 -04:00
<template>
<span
:class="['user', nickColor, {active: active}]"
2018-07-08 15:02:36 -04:00
:data-name="user.original.nick"
2018-07-08 16:08:08 -04:00
role="button"
@mouseover="hover"
2019-11-09 17:21:34 -05:00
@contextmenu.prevent="rightClick($event)"
v-html="user.original.mode + user.string"
/>
2018-07-08 15:02:36 -04:00
</template>
<script>
2019-11-16 12:24:03 -05:00
import colorClass from "../js/helpers/colorClass";
2018-07-08 15:02:36 -04:00
export default {
name: "UsernameFiltered",
props: {
user: Object,
active: Boolean,
2018-07-10 19:25:21 -04:00
onHover: Function,
2019-11-09 17:21:34 -05:00
contextMenuCallback: Function,
2018-07-10 19:25:21 -04:00
},
computed: {
nickColor() {
return colorClass(this.user.original.nick);
},
},
2018-07-10 19:25:21 -04:00
methods: {
hover() {
this.onHover ? this.onHover(this.user.original) : null;
},
2019-11-09 17:21:34 -05:00
rightClick($event) {
if (this.contextMenuCallback) {
this.contextMenuCallback($event, this.user);
}
},
2018-07-08 15:02:36 -04:00
},
};
</script>