Only bind mouseover on username if necessary

This commit is contained in:
Pavel Djundik 2018-07-11 10:33:11 +03:00 committed by Pavel Djundik
parent 48187a0260
commit d97356e65a
3 changed files with 6 additions and 7 deletions

View File

@ -28,7 +28,7 @@
<template v-if="userSearchInput.length > 0">
<UsernameFiltered
v-for="user in users"
:onHover="hoverUser"
:on-hover="hoverUser"
:key="user.original.nick"
:active="user.original === activeUser"
:user="user"/>
@ -36,7 +36,7 @@
<template v-else>
<Username
v-for="user in users"
:onHover="hoverUser"
:on-hover="hoverUser"
:key="user.nick"
:active="user === activeUser"
:user="user"/>

View File

@ -2,9 +2,8 @@
<span
:class="['user', $options.filters.colorClass(user.nick), active ? 'active' : '']"
:data-name="user.nick"
role="button">{{ user.mode }}{{ user.nick }}
@mouseover="hover"
></span>
role="button"
v-on="onHover ? { mouseover: hover } : {}">{{ user.mode }}{{ user.nick }}</span>
</template>
<script>
@ -17,7 +16,7 @@ export default {
},
methods: {
hover() {
this.onHover ? this.onHover(this.user) : null;
return this.onHover(this.user);
},
},
};

View File

@ -2,8 +2,8 @@
<span
:class="['user', $options.filters.colorClass(user.original.nick), active ? 'active' : '']"
:data-name="user.original.nick"
@mouseover="hover"
role="button"
@mouseover="hover"
v-html="user.original.mode + user.string"/>
</template>