<template>
  <div class="more-content">
    <div class="more-body">{{ content }}</div>
    <transition name="fade-slide" mode="out-in" appear>
      <div class="more-action" @click="emit('action')">{{ actionText }}</div>
    </transition>
  </div>
</template>

<script setup name="MoreContent">
const props = defineProps({
  content: {
    type: String,
    required: true,
  },
  actionText: {
    type: String,
    default: '查看详情',
  },
});
const emit = defineEmits(['action']);
</script>

<style lang="less" scoped>
.more-content {
  color: @dark-text-color;
  line-height: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .more-body {
    flex-flow: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: @brand-color;
  }
  .more-action {
    flex-shrink: 0;
    flex-flow: 0;
    background-color: #fff;
    padding-left: 8px;
    color: @light-text-color;
    cursor: pointer;
    display: none;

    &:hover {
      color: @brand-color;
    }
  }

  &:hover {
    .more-action {
      display: block;
    }
  }
}
</style>
