<template>
  <div class="combined-box">
    <div style="display: flex">
      <div
          class="trapezoid"
          :class="{ active: selected === 'trapezoid' }"
          @click="selected = 'trapezoid'"
      >
        整体评价
      </div>
      <div
          class="trapezoid2"
          :class="{ active: selected === 'trapezoid2' }"
          @click="selected = 'trapezoid2'"
      >
        逐句评价
      </div>
    </div>
    <template v-if="selected === 'trapezoid'">
      <div class="rectangle">
        <p>This is the content of the rectangle. You can put anything you want here.</p>
      </div>
    </template>
    <template v-else>
      <div class="rectangle">
        <p>2222222222222This is the content of the rectangle. You can put anything you want here.</p>
      </div>
    </template>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const selected = ref('trapezoid');
</script>

<style scoped>
.combined-box {
  width: 100%; /* 整体宽度 */
  height: 100%;
}

.trapezoid {
  width: 100px; /* 梯形底边长度 */
  height: 0;
  border-bottom: 30px solid #a3a3a3; /* 梯形高度和颜色 */
  border-right: 20px solid transparent;
  line-height: 30px; /* 与 border-bottom 高度相等 */
  text-align: center; /* 水平居中 */
  z-index: 1;
  cursor: pointer;
}

.trapezoid2 {
  width: 100px; /* 梯形底边长度 */
  height: 0;
  border-bottom: 30px solid #a3a3a3; /* 梯形高度和颜色 */
  border-right: 20px solid transparent;
  border-left: 20px solid transparent;
  margin-left: -20px;
  z-index: 2;
  line-height: 30px; /* 与 border-bottom 高度相等 */
  text-align: center; /* 水平居中 */
  cursor: pointer;
}

.trapezoid.active {
  border-bottom: 30px solid #fff;
  z-index: 10;
}

.trapezoid2.active {
  border-bottom: 30px solid #fff;
  z-index: 10;
}

.rectangle {
  width: 100%; /* 长方形宽度 */
  height: calc(100% - 30px - 2vh); /* 长方形高度 */
  border-top: none; /* 去掉顶部边框，使其与梯形无缝连接 */
  /* 长方形底部的圆角 */
  align-items: center;
  padding: 20px;
  background-color: #fff; /* 长方形的背景颜色 */
  border-radius: 0 5px 5px 5px;
}
</style>
