首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Vue框架Element UI教程-出现和隐藏动画(三)

Vue框架Element UI教程-出现和隐藏动画(三)

作者头像
王小婷
发布于 2025-05-18 18:32:07
发布于 2025-05-18 18:32:07
3630
举报
文章被收录于专栏:编程微刊编程微刊

Element UI手册:https://cloud.tencent.com/developer/doc/1270

中文文档:http://element-cn.eleme.io/#/zh-CN

github地址:https://github.com/ElemeFE/element

​


接前两篇,

Vue框架Element UI教程-安装环境搭建(一)https://cloud.tencent.com/developer/article/1425275

今天继续写组件的运用相关例子

点击按钮的时候,元素会呈现一个出现和隐藏的动画功能。

代码语言:javascript
复制
<template>
  <div>
    <el-button @click="show = !show">点击按钮</el-button>
    <div style="display: flex; margin-top: 20px; height: 100px;">
      <transition name="el-fade-in-linear">
        <div v-show="show" class="transition-box">我会消失在人海之中</div>
      </transition>
    </div>
  </div>
</template>
<script>
    export default {
    data: () => ({
      show: true
    })
  }
</script>
<style>
  .transition-box {
    margin-bottom: 10px;
    width: 300px;
    height: 100px;
    border-radius: 4px;
    background-color: #42B983;
    text-align: center;
    color: #fff;
    padding: 40px 20px;
    box-sizing: border-box;
    margin-left: 520px;
  }
</style>

效果大家可以自行尝试。

5640239-536d8a00d20ec0d2.gif
5640239-536d8a00d20ec0d2.gif

原文作者:祈澈姑娘 技术博客:https://www.jianshu.com/u/05f416aefbe1 90后前端妹子,爱编程,爱运营,文艺与代码齐飞,魅力与智慧共存的程序媛一枚,对于博客上面有不会的问题

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-05-16,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档