L
L
lemonlimelike2018-06-16 04:17:28
css
lemonlimelike, 2018-06-16 04:17:28

How to make such a function in vue?

I have this div block:

<div class="uk-navbar-right">
                <ion-icon @mouseover="mouseover" v-show="mouse2" name="search" size="large"></ion-icon>                
                    <form action="#">
                        <div class="uk-inline">
                            <ion-icon v-show="mouse" v-bind:class="{{@style}}" name="search" size="large"></ion-icon>
                            <input v-show="show" type="text" class="uk-input" placeholder="{{ @message }}">    
                        </div>
                    </form>
                </div>

And here is the vue code:
<script>
        new Vue({
            el:"#header",
            data:{
                message: "Hello World",
                show: false,
                mouse: false,
                mouse2: true,
                style: "uk-form-icon uk-form-icon-flip"
            },
            methods:{
                mouseover: function(){
                    this.show = !this.show
                    this.mouse = !this.mouse
                    this.mouse2 = !this.mouse2
                }
            }
        })
    </script>

Of course, this is some piece of shit ... but I'm just getting started.
The code works but not completely... There is an icon on the page, and when you hover over it, a search field (input) should appear, and if the user removes the cursor from the input, then it disappears, how to do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Argumentus, 2018-06-16
@Argumentus

Why can't css be broken?

M
Miki06, 2019-10-03
@Miki06

"@mouseenter" try

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question