index.vue 984 Bytes
<template>
    <div>
        <div class="bar-title" @click="changeStatus()">
            <i class="el-icon-caret-right btn" v-if="!isExpansion"></i>
            <i class="el-icon-caret-bottom btn" v-else></i>
            <span class="title">{{name}}</span>
        </div>
        <slot v-if="isExpansion"></slot>
    </div>
</template>
  
  <script>
  export default {
    name: 'FoldFrame',
    props: {
      name: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        isExpansion: true
      }
    },
    methods: {
        changeStatus(){
            this.isExpansion = !this.isExpansion
        }
    }
  }
  </script>
  <style lang="scss" scoped>
   .bar-title{
        font-weight: 600;
        font-size: 14px;
        color: #000000d9;
        height: 40px;
        line-height: 40px;
        padding: 0 20px;
        cursor: pointer;
        .btn{
          margin-right: 9px;
          font-size: 16px;
        }
    }
  </style>