<template>
  <el-link type="primary" :class="{'showButton':true,show:show}" :underline="false" @click="show=!show">
    <i :class="show?'el-icon-arrow-up':'el-icon-arrow-down'" />{{ foldName }}
  </el-link>
</template>

<script>
export default {
  name: 'DkFoldLink',
  props: {
    value: {
      default: false,
      type: Boolean
    }
  },
  data() {
    return {
      show: this.value
    }
  },
  computed: {
    foldName() {
      return this.show === false ? '展开' : '收起'
    }
  },
  watch: {
    value(val) {
      this.show = val
    },
    show(val) {
      this.$emit('input', val)
    }
  }
}
</script>

<style scoped>

</style>
