add collapse item

This commit is contained in:
Владимир Фёдоров 2026-03-01 01:28:11 +07:00
parent 9bde8ff7ee
commit 046ebfc62f

View File

@ -17,6 +17,8 @@ type Action = {
name: string name: string
text: string text: string
applications: Application[] applications: Application[]
isOpen: boolean
} }
type Team = { type Team = {
@ -72,8 +74,16 @@ function getTeam() {
return res return res
}) })
.then(data => { .then(data => {
const oldActions = team.value.actions
team.value = data team.value = data
const newActions = team.value?.actions const newActions = team.value?.actions
newActions.forEach(item => {
item.isOpen = true
})
for (let i = 0; i < actions.value.length; i++) {
newActions[i].isOpen = oldActions[i].isOpen
}
if (actions.value.length !== newActions?.length) { if (actions.value.length !== newActions?.length) {
actions.value = newActions actions.value = newActions
} }
@ -216,7 +226,10 @@ onMounted(() => {
<div class="message-cloud"> <div class="message-cloud">
<div class="message-header"> <div class="message-header">
{{ action.place }}: {{ action.name }} {{ action.place }}: {{ action.name }}
<span class="collapse-icon" @click="action.isOpen = !action.isOpen" style="float: right;">{{
action.isOpen ? '' : '+' }}</span>
</div> </div>
<div v-show="action.isOpen">
<hr class="hr" /> <hr class="hr" />
<div class="message-content"> <div class="message-content">
{{ action.text }} {{ action.text }}
@ -230,6 +243,7 @@ onMounted(() => {
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
@ -326,4 +340,9 @@ body {
text-align: center; text-align: center;
width: 200px; width: 200px;
} }
.collapse-icon {
padding: 0 15px;
cursor: pointer;
}
</style> </style>