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

View File

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

View File

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