Skip to content

A full-featured download manager.

fix: task name text overflow ellipsis

Dr_rOot9b9e1371eacc
diff --git a/src/renderer/components/Task/TaskItem.vue b/src/renderer/components/Task/TaskItem.vue
index a32ab5e1..297803ea 100644
--- a/src/renderer/components/Task/TaskItem.vue
+++ b/src/renderer/components/Task/TaskItem.vue
@@ -1,6 +1,8 @@
<template>
<li :key="task.gid" class="task-item" v-on:dblclick="toggleTask">
- <div class="task-name" :title="taskName">{{ taskName }}</div>
+ <div class="task-name" :title="taskName">
+ <span>{{ taskName }}</span>
+ </div>
<mo-task-item-actions mode="LIST" :task="task" />
<div class="task-progress">
<mo-task-progress :completed="Number(task.completedLength)" :total="Number(task.totalLength)" :status="task.status" />
@@ -95,11 +97,18 @@
}
}
.task-name {
- font-size: 14px;
color: #505753;
- line-height: 26px;
margin-bottom: 32px;
- margin-right: 200px;
+ margin-right: 240px;
+ &> span {
+ font-size: 14px;
+ line-height: 26px;
+ overflow : hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ }
}
.task-speed {
font-size: 12px;
diff --git a/src/renderer/components/Task/TaskItemInfo.vue b/src/renderer/components/Task/TaskItemInfo.vue
index 49cbf9c5..06696a6b 100644
--- a/src/renderer/components/Task/TaskItemInfo.vue
+++ b/src/renderer/components/Task/TaskItemInfo.vue
@@ -3,13 +3,15 @@
custom-class="task-info-dialog"
width="61.8vw"
v-if="task"
- :title="`${taskName} 详情`"
+ :title="dialogTitle"
:show-close="true"
:visible.sync="visible"
:before-close="handleClose"
@closed="handleClosed"
>
- <div class="task-name" :title="taskName">{{ taskName }}</div>
+ <div class="task-name" :title="taskName">
+ <span>{{ taskName }}</span>
+ </div>
<mo-task-item-actions mode="ITEM" :task="task" />
<div class="task-progress">
<mo-task-progress :completed="Number(task.completedLength)" :total="Number(task.totalLength)" :status="task.status" />
@@ -69,6 +71,11 @@
taskName: function () {
return getTaskName(this.task, '获取任务名中...')
},
+ dialogTitle: function () {
+ const len = this.taskName.length
+ let title = len > 40 ? this.taskName.substr(0, 40) + '...' : this.taskName
+ return `${title} 详情`
+ },
remaining: function () {
const { totalLength, completedLength, downloadSpeed } = this.task
return timeRemaining(totalLength, completedLength, downloadSpeed)
@@ -95,20 +102,24 @@
<style lang="scss">
.task-info-dialog {
+ .el-dialog__header {
+ padding-right: 60px;
+ }
.el-dialog__body {
position: relative;
}
+ .task-name {
+ font-size: 14px;
+ color: #505753;
+ line-height: 26px;
+ margin-bottom: 32px;
+ margin-right: 200px;
+ }
}
.task-item-info {
padding: 16px 12px;
}
- .task-name {
- font-size: 14px;
- color: #505753;
- line-height: 26px;
- margin-bottom: 32px;
- margin-right: 240px;
- }
+
.task-item-actions {
display: inline-block;
position: absolute;
diff --git a/src/renderer/components/Theme/Variables.scss b/src/renderer/components/Theme/Variables.scss
index c6ac41c5..48f7448b 100644
--- a/src/renderer/components/Theme/Variables.scss
+++ b/src/renderer/components/Theme/Variables.scss
@@ -748,7 +748,7 @@ $--subnav-active-text-color: $--color-primary !default;
-------------------------- */
$--panel-background: $--color-white !default;
$--panel-title-color: $--color-text-primary !default;
-$--panel-border-color: #EBECF0 !default;
+$--panel-border-color: rgba(0, 0, 0, 0.1) !default;
/* Task
-------------------------- */