Skip to content

Commit 6f70172

Browse files
committed
refactor: view preview
1 parent 2be094a commit 6f70172

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed
Lines changed: 3 additions & 0 deletions
Loading

frontend/src/views/dashboard/canvas/ComponentBar.vue

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import { toRefs } from 'vue'
33
import icon_delete from '@/assets/svg/icon_delete.svg'
44
import { Icon } from '@/components/icon-custom'
55
import { useEmitt } from '@/utils/useEmitt.ts'
6+
import { useI18n } from 'vue-i18n'
7+
import icon_more_outlined from '@/assets/svg/icon_more_outlined.svg'
8+
import icon_chart_preview from '@/assets/svg/icon_chart_preview.svg'
9+
const { t } = useI18n()
610
711
const props = defineProps({
812
active: {
@@ -26,6 +30,10 @@ const props = defineProps({
2630
2731
const { configItem } = toRefs(props)
2832
33+
const doPreview = () => {
34+
// do preview
35+
}
36+
2937
const doDeleteComponent = (e: MouseEvent) => {
3038
e.stopPropagation()
3139
e.preventDefault()
@@ -36,11 +44,23 @@ const doDeleteComponent = (e: MouseEvent) => {
3644
<template>
3745
<div class="component-bar-main" :class="{ 'bar-hidden': !active }">
3846
<div>
39-
<el-icon class="handle-icon" @click="doDeleteComponent">
40-
<Icon>
41-
<icon_delete class="svg-icon"></icon_delete>
42-
</Icon>
43-
</el-icon>
47+
<el-dropdown ref="curDropdown" trigger="click" placement="bottom-end">
48+
<el-icon class="bar-more">
49+
<el-tooltip :content="t('dashboard.more')" placement="bottom">
50+
<icon name="icon_more_outlined"><icon_more_outlined class="svg-icon" /></icon>
51+
</el-tooltip>
52+
</el-icon>
53+
<template #dropdown>
54+
<el-dropdown-menu>
55+
<el-dropdown-item :icon="icon_chart_preview" @click="doPreview">{{
56+
t('dashboard.preview')
57+
}}</el-dropdown-item>
58+
<el-dropdown-item divided :icon="icon_delete" @click="doDeleteComponent">{{
59+
t('dashboard.delete')
60+
}}</el-dropdown-item>
61+
</el-dropdown-menu>
62+
</template>
63+
</el-dropdown>
4464
</div>
4565
</div>
4666
</template>
@@ -54,16 +74,27 @@ const doDeleteComponent = (e: MouseEvent) => {
5474
display: flex;
5575
z-index: 5;
5676
cursor: pointer !important;
57-
.handle-icon {
58-
color: #646a73;
59-
}
60-
&:hover {
61-
background-color: #e8f0fe;
62-
color: var(--el-color-primary);
63-
}
6477
}
6578
6679
.bar-hidden {
6780
display: none;
6881
}
82+
83+
.bar-more {
84+
width: 24px;
85+
height: 24px;
86+
color: rgba(31, 35, 41, 1);
87+
border-radius: 6px;
88+
background: rgba(255, 255, 255, 1);
89+
border: 1px solid rgba(217, 220, 223, 1);
90+
padding: 8px;
91+
92+
&:hover {
93+
background-color: rgba(245, 246, 247, 1);
94+
}
95+
96+
&:active {
97+
background-color: rgba(245, 246, 247, 0.5);
98+
}
99+
}
69100
</style>

0 commit comments

Comments
 (0)