/
githubmirror
/
Motrix
Обзор
Документация
Войти
/
githubmirror
/
Motrix
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/renderer/components/Task/TaskProgress.vue
48 строк
927 B
Dr_rOot
refactor: task status
18 апр 2020, 05:38
18 апр 2020, 05:38
f67b9b8
Код
Авторство
О чём код?
<template> <el-progress v-if="isActive" :percentage="percent" :show-text="false" status="success" :color="color"> </el-progress> <el-progress v-else :percentage="percent" :show-text="false" :color="color"> </el-progress> </template> <script> import { TASK_STATUS } from '@shared/constants' import { calcProgress } from '@shared/utils' import colors from '@shared/colors' export default { name: 'mo-task-progress', props: { total: { type: Number }, completed: { type: Number }, status: { type: String, default: TASK_STATUS.ACTIVE } }, computed: { isActive () { return this.status === TASK_STATUS.ACTIVE }, percent () { return calcProgress(this.total, this.completed) }, color () { return colors[this.status] } } } </script>