elementUI內置過渡(折疊)


elementUI內置過渡動畫(折疊),使用<el-collapse-transition>標簽包裹要折疊的元素即可

例子:

<template>
  <div>
    <div class="ctn">
      <!-- 使用el-collapse-transition標簽包裹着需要折疊的元素 -->
      <el-collapse-transition>
        <div class="box" v-show="show">el-collapse-transition</div>
      </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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM