ref
This commit is contained in:
1 parent
5578062bc8
commit
d8ed8e78b7
1 file changed
+14
-2
@@ -26,7 +26,6 @@
|
|||||||
<v-tabs-window v-model="activeTab">
|
<v-tabs-window v-model="activeTab">
|
||||||
<v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">
|
<v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">
|
||||||
<v-row>
|
<v-row>
|
||||||
<!-- Победитель -->
|
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<h3 class="text-center">{{ question.name }}</h3>
|
<h3 class="text-center">{{ question.name }}</h3>
|
||||||
<v-card-title class="d-flex ga-2 align-center">
|
<v-card-title class="d-flex ga-2 align-center">
|
||||||
@@ -56,6 +55,13 @@
|
|||||||
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
|
<v-progress-linear
|
||||||
|
:model-value="getPercentage(answer.count, question)"
|
||||||
|
height="10"
|
||||||
|
color="teal-darken-4"
|
||||||
|
striped
|
||||||
|
rounded
|
||||||
|
/>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
@@ -114,6 +120,11 @@ export default {
|
|||||||
return currentVote
|
return currentVote
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPercentage = (count, question) => {
|
||||||
|
const totalVotes = question.answers.reduce((sum, answer) => sum + answer.count, 0);
|
||||||
|
return totalVotes > 0 ? (count / totalVotes) * 100 : 0;
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeTab,
|
activeTab,
|
||||||
questions,
|
questions,
|
||||||
@@ -123,7 +134,8 @@ export default {
|
|||||||
shouldShowTooltip,
|
shouldShowTooltip,
|
||||||
voteCount,
|
voteCount,
|
||||||
title,
|
title,
|
||||||
description
|
description,
|
||||||
|
getPercentage
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user