Transtion in vue is an animation transition encapsulation component. A common scenario is that the DOM wrapped with the transition tag contains animation effects. The animation effect transition settings of the transition component are based on the transition property settings of CSS. Here I will introduce the application of transition components in Vue in the project. Single pop-up applicationNotice:
<template> <div> <button v-on:click="show = !show"> Toggle </button> <transition name="fade"> <p v-if="show">hello</p> </transition> </div> </template> <script> export default { data () { return { show: true } }, } </script> <style scoped lang="less"> .fade-enter-active, .fade-leave-active { transition: all .5s; } .fade-leave-to { opacity: 0; transform: translateX(20px); } .fade-enter{ opacity: 0; transform: translateX(-20px); } </style> Content switching control effectNotice:
<template> <div> <transition name="fade"> <button class="position" @click="change" :key="status"> Component</button> </transition> </div> </template> <script> export default { data () { return { status: '1', } }, methods: { change () { if(this.docState === '1'){ this.docState = '2' }else{ this.docState = '1' } } } } </script> <style scoped lang="less"> .fade-enter-active, .fade-leave-active { transition: all .5s; } .fade-leave-to { opacity: 0; transform: translateX(20px); } .fade-enter{ opacity: 0; transform: translateX(-20px); } .position{ position: absolute; } </style> Use with animate frameworkNotice
<link href="https://cdn.jsdelivr.net/npm/[email protected]" rel="external nofollow" rel="stylesheet" type="text/css"> <div id="example-3"> <button @click="show = !show"> Toggle render </button> <transition name="custom-classes-transition" enter-active-class="animated tada" leave-active-class="animated bounceOutRight" > <p v-if="show">hello</p> </transition> </div> The page is loaded for the first time and the animation is executedAdding appear to transition This is the end of this article about the application of transition components in Vue projects. For more relevant content about transition components in Vue, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: The pitfall record of case when judging NULL value in MySQL
Table of contents 1. Uninstall the original drive...
Introduction Animation allows you to easily imple...
question Recently I encountered a requirement to ...
This article shares the specific code of JavaScri...
<br />Choose the most practical one to talk ...
The floating-point types supported in MySQL are F...
The command format for mysql login is: mysql -h [...
1. What is pip pip is a Python package management...
I'm currently learning about MySQL optimizati...
In actual development, the primary key of MySQL c...
To beautify the table, you can set different bord...
The main contents of this article are as follows:...
This article shares a dynamic loading progress ba...
Table of contents 1. The significance of users an...
1. Install tomcat8 with docker 1. Find the tomcat...