<template>
  <div class="rt-heading" :style="styles">
    <span>{{text}}</span>
    <span v-if="rightText" @click="click" class="rt-heading__text--right">{{rightText}}</span>
  </div>
</template>

<script>
export default {
  name: 'rtHeading',
  props: {
    text: {
      type: String,
      required: true
    },
    margin: {
      type: String,
      default: '20px 0 10px 10px'
    },
    fontSize: {
      type: String,
      default: '15px'
    },
    color: {
      type: String,
      default: '#555'
    },
    rightText: {
      type: String
    },
    rightTextColor: {
      type: String,
      default: '#53a4fc'
    }
  },
  computed: {
    styles() {
      return {
        margin: this.margin,
        fontSize: this.fontSize,
        color: this.color
      };
    }
  },
  methods: {
    click() {
      this.$emit('handle-click');
    }
  }
};
</script>

<style lang="less">
.rt-heading {
  display: flex;
  .rt-heading__text--right {
    margin-left: auto;
    font-size: 14px;
    color: #53a4fc;
    padding-right: 14px;
  }
}
</style>
