Vue example code using transition component animation effect

Vue example code using transition component animation effect

Transition document address defines a background pop-up layer to achieve fade-in and fade-out effects

<template>
 <div>
  <button @click="show = !show">
   Toggle
  </button>
  <transition name="fadeBg">
   <div class="bg" v-if="show">hello</div>
  </transition>
 </div>
</template>

<script>
 export default {
  data: () => ({
   show: true
  }),
 };
</script>

<style lang="less" scoped>
 .fadeBg-enter-active,
 .fadeBg-leave-active {
  transition: opacity 0.3s ease;
 }

 .fadeBg-enter,
 .fadeBg-leave-to {
  opacity: 0;
 }

 .bg {
  position: fixed;
  top: 20px;
  left: 0;
  z-index: 105;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
 }
</style>

This is the end of this article about the example code of using transition component animation effect in Vue. For more relevant Vue transition component animation content, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Solution to Vue transition failure in child components
  • Detailed explanation of the use of Vue components keep-alive and transition
  • How to implement transition encapsulation components in Vue
  • Use transition and transition-group in vue components to implement transition animation
  • Summary of the application of transition components in Vue projects

<<:  A brief discussion on docker-compose network settings

>>:  MySQL5.6.31 winx64.zip installation and configuration tutorial

Recommend

How to quickly deploy an Elasticsearch cluster using docker

This article will use Docker containers (orchestr...

3 ways to add links to HTML select tags

The first one : Copy code The code is as follows: ...

Today I will share some rare but useful JS techniques

1. Back button Use history.back() to create a bro...

Simple CSS text animation effect

Achieve results Implementation Code html <div ...

MySQL graphical management tool Navicat installation steps

Table of contents Preface 1. Arrange the installa...

CSS3 realizes the childhood paper airplane

Today we are going to make origami airplanes (the...

Example of configuring multiple SSL certificates for a single Nginx IP address

By default, Nginx supports only one SSL certifica...

Sample code for making desktop applications with vue + Electron

1.vue packaging Here we use the vue native packag...

Detailed explanation of writing multiple conditions of CSS: not

The :not pseudo-class selector can filter element...

Summary of the differences between global objects in nodejs and browsers

In Node.js, a .js file is a complete scope (modul...

Application example tutorial of key in Vue page rendering

introduction During the front-end project develop...

mysql having usage analysis

Usage of having The having clause allows us to fi...