Home >Web Front-end >Vue.js >How vue.js implements the move-in and move-out effect

How vue.js implements the move-in and move-out effect

王林
王林Original
2021-09-30 14:30:252957browse

Vue.js method to implement the move-in and move-out effect: [methods:{enter(index){this.seen = true;this.current = index;},leave(){this.seen = false;this .cur...].

How vue.js implements the move-in and move-out effect

The operating environment of this article: windows10 system, vue 2.5.2, thinkpad t480 computer.

vue.js specific code to implement move-in and move-out events:

html code:

<i class="icon" @mouseenter="enter(index)" @mouseleave="leave()"></i>

Logic code:

methods:{
      enter(index){
        this.seen = true;
        this.current = index;
      },
      leave(){
        this.seen = false;
        this.current = null;
      }
    }

Recommended learning: php Training

The above is the detailed content of How vue.js implements the move-in and move-out effect. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn