92 lines
1.6 KiB
Vue
92 lines
1.6 KiB
Vue
<template>
|
|
<div class="answer-card">
|
|
<h3 class="answer-title">我的答案</h3>
|
|
<div class="option-list">
|
|
<button
|
|
v-for="option in options"
|
|
:key="option.value"
|
|
class="option-item"
|
|
:class="{ selected: modelValue === option.value }"
|
|
type="button"
|
|
@click="emit('update:modelValue', option.value)"
|
|
>
|
|
<span class="option-key">{{ option.value }}</span>
|
|
<span class="option-text">{{ option.label }}</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
defineProps<{
|
|
modelValue?: string;
|
|
options: Array<{ value: string; label: string }>;
|
|
}>();
|
|
|
|
const emit = defineEmits<{
|
|
(event: "update:modelValue", value: string): void;
|
|
}>();
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.answer-card {
|
|
height: 100%;
|
|
border-radius: 18px;
|
|
background: #fff;
|
|
padding: 0 32px;
|
|
}
|
|
|
|
.answer-title {
|
|
font-size: 32px;
|
|
color: #2f333a;
|
|
margin-bottom: 24px;
|
|
// padding-left: 8px;
|
|
}
|
|
|
|
.option-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 24px;
|
|
}
|
|
|
|
.option-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0;
|
|
text-align: left;
|
|
border: 2px solid #dbe7f5;
|
|
border-radius: 12px;
|
|
background: #fff;
|
|
padding: 0;
|
|
cursor: pointer;
|
|
overflow: hidden;
|
|
min-height: 92px;
|
|
|
|
&.selected {
|
|
border-color: #2b80ea;
|
|
color: #2D6FE0;
|
|
}
|
|
}
|
|
|
|
.option-key {
|
|
width: 88px;
|
|
min-height: 92px;
|
|
background: #edf4fd;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-weight: 500;
|
|
font-size: 44px;
|
|
// color: #1f2a3a;
|
|
border-right: 1px solid #dce8f6;
|
|
|
|
|
|
}
|
|
|
|
.option-text {
|
|
font-size: 32px;
|
|
// color: #2f333a;
|
|
padding: 0 22px;
|
|
}
|
|
</style>
|