elementUI内置过渡(折叠)

elementUI内置过渡动画(折叠),使用标签包裹要折叠的元素即可

例子:

<template>
  <div>
    <div class="ctn">
      
      <el-collapse-transition>
        <div class="box" v-show="show">el-collapse-transitiondiv>
      el-collapse-transition>
    div>
    <el-button type="primary" @click="test()">折叠el-button>
  div>
template>
<script>
export default {
  name: "HelloWorld",
  data() {
    return {
      show: true
    };
  },
  methods: {
    test() {
      this.show = !this.show;
    }
  }
};
script>
<style lang="css" scoped>
.ctn {
  width: 500px;
  height: 300px;
}

.box {
  display: inline-block;
  width: 200px;
  height: 200px;
  line-height: 200px;
  text-align: center;
  color: #fff;
  background-color: greenyellow;
  margin-right: 20px;
}
style>

 

你可能感兴趣的:(elementUI内置过渡(折叠))