<template>
  <div class="collapse-title" @click="onChange" >
    <div class="title">{{title}}</div>
    <el-link type="primary" :underline="false">
      <template v-if="value">
        收起<i class="el-icon-arrow-up"/>
      </template>
      <template v-else>
        展开<i class="el-icon-arrow-down"/>
      </template>
    </el-link>
  </div>
</template>
<script>
export default {
  name: "CollapseTitle",
  props: {
    title: {
      type: String,
      default: null
    },
    value: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    onChange() {
      this.$emit('input', !this.value);
    }
  }
}
</script>

<style scoped lang="scss">
.collapse-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  background-color: rgba(175, 251, 218, 0.1);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: .25s;
  &:hover {
    background-color: rgba(175, 251, 218, 0.35);
  }
  .title {
    font-size: 14px;
    color: #1ab394;
    flex: 1;
  }
}
</style>
