Files
text-adventure-game/components/common/Collapse.vue
Claude cb412544e9 Initial commit: Text Adventure Game
Features:
- Combat system with AP/EP hit calculation and three-layer defense
- Auto-combat/farming mode
- Item system with stacking support
- Skill system with levels, milestones, and parent skill sync
- Shop system with dynamic pricing
- Inventory management with bulk selling
- Event system
- Game loop with offline earnings
- Save/Load system

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:13:51 +08:00

65 lines
1.2 KiB
Vue

<template>
<view class="collapse">
<view class="collapse__header" @click="toggle">
<text class="collapse__title">{{ title }}</text>
<text class="collapse__arrow">{{ isExpanded ? '▼' : '▶' }}</text>
</view>
<view v-show="isExpanded" class="collapse__content">
<slot></slot>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
const props = defineProps({
title: { type: String, default: '' },
expanded: { type: Boolean, default: false }
})
const emit = defineEmits(['toggle'])
const isExpanded = ref(props.expanded)
function toggle() {
isExpanded.value = !isExpanded.value
emit('toggle', isExpanded.value)
}
</script>
<style lang="scss" scoped>
.collapse {
border-top: 1rpx solid $border-color;
&__header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx;
background-color: $bg-secondary;
cursor: pointer;
&:active {
background-color: $bg-tertiary;
}
}
&__title {
color: $text-primary;
font-size: 28rpx;
}
&__arrow {
color: $text-secondary;
font-size: 20rpx;
transition: transform 0.2s;
}
&__content {
padding: 16rpx;
background-color: $bg-primary;
}
}
</style>