Все вроде лаконично, но после первого рендеринга v-if при изменении isActive ничего не происходит.
<script src="https://unpkg.com/vue"></script>
<div
id="search"
class="search"
@mouseenter="toggle"
@mouseleave="toggle"
>
<span v-if="!isActive">a</span>
<span v-else>b</span>
<input
type="text"
class="search__input"
placeholder="Это инпут">
</div>
new Vue({
el: '#search',
data: {
isActive: false
},
methods: {
toggle: () => {
this.isActive = !this.isActive;
}
}
})
:active, :hover, :focus {
outline: none;
outline-offset: none;
}
.search {
flex-direction: row;
justify-content: flex-end;
align-items: center;
display: inline-block;
}
.search:hover, .search-active {
border-bottom: 1px solid blue;
}
.search__input {
background: transparent;
border: none;
}