AttributionGuide.vue 1.51 KB
<template>
  <van-popup
    v-model="localVisible"
    position="bottom"
    round
    :style="{ height: '80%' }"
    closeable
    close-icon="cross"
    :close-on-click-overlay="true"
    @close="$emit('close')"
  >
    <div class="px-3 pt-5 pb-3 border-b border-gray-100">
      <h3 class="text-[17px] font-semibold text-gray-900">{{ title }}</h3>
    </div>
    <div class="overflow-y-auto px-5 py-4" style="height: calc(80vh - 80px);">
      <div
        v-for="(item, index) in descriptions"
        :key="index"
        class="mb-3 last:mb-0 p-2 bg-gray-50 rounded-xl"
      >
        <div class="flex items-start gap-2">
          <div class="w-2 h-2 rounded-full bg-green-500 flex-shrink-0 mt-2"></div>
          <div class="flex-1">
            <div class="text-[12px] font-semibold text-gray-900 mb-2">{{ item.label }}</div>
            <div class="text-[10px] text-gray-600 leading-relaxed">{{ item.description }}</div>
          </div>
        </div>
      </div>
    </div>
  </van-popup>
</template>

<script>
export default {
  name: 'AttributionGuide',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: '归因说明'
    },
    descriptions: {
      type: Array,
      default: () => []
    }
  },
  computed: {
    localVisible: {
      get() {
        return this.visible
      },
      set(value) {
        if (!value) {
          this.$emit('close')
        }
      }
    }
  }
}
</script>